Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / options / browser_options.js
index 92b5656..7d6f04b 100644 (file)
@@ -77,8 +77,11 @@ cr.define('options', function() {
       $('advanced-settings').addEventListener('webkitTransitionEnd',
           this.updateAdvancedSettingsExpander_.bind(this));
 
-      if (cr.isChromeOS)
+      if (cr.isChromeOS) {
         UIAccountTweaks.applyGuestModeVisibility(document);
+        if (loadTimeData.getBoolean('secondaryUser'))
+          $('secondary-user-banner').hidden = false;
+      }
 
       // Sync (Sign in) section.
       this.updateSyncState_(loadTimeData.getValue('syncData'));
@@ -98,6 +101,14 @@ cr.define('options', function() {
       // Internet connection section (ChromeOS only).
       if (cr.isChromeOS) {
         options.network.NetworkList.decorate($('network-list'));
+        // Show that the network settings are shared if this is a secondary user
+        // in a multi-profile session.
+        if (loadTimeData.getBoolean('secondaryUser')) {
+          var networkIndicator = document.querySelector(
+              '#network-section-header > .controlled-setting-indicator');
+          networkIndicator.setAttribute('controlled-by', 'shared');
+          networkIndicator.location = cr.ui.ArrowLocation.TOP_START;
+        }
         options.network.NetworkList.refreshNetworkData(
             loadTimeData.getValue('networkData'));
       }
@@ -128,9 +139,7 @@ cr.define('options', function() {
         OptionsPage.navigateToPage('homePageOverlay');
       };
 
-      Preferences.getInstance().addEventListener('hotword.search_enabled',
-          this.onHotwordSearchPrefChanged_.bind(this));
-      chrome.send('requestHotwordAvailabile');
+      chrome.send('requestHotwordAvailable');
 
       if ($('set-wallpaper')) {
         $('set-wallpaper').onclick = function(event) {
@@ -182,6 +191,10 @@ cr.define('options', function() {
       // Users section.
       if (loadTimeData.valueExists('profilesInfo')) {
         $('profiles-section').hidden = false;
+        $('sync-users-section').hidden =
+            $('profiles-section').hidden &&
+            $('sync-section').hidden &&
+            $('profiles-supervised-dashboard-tip').hidden;
 
         var profilesList = $('profiles-list');
         options.browser_options.ProfileList.decorate(profilesList);
@@ -232,6 +245,11 @@ cr.define('options', function() {
           chrome.send('coreOptionsUserMetricsAction',
               ['Options_ManageAccounts']);
         };
+
+        document.querySelector(
+            '#enable-screen-lock + span > .controlled-setting-indicator').
+            setAttribute('textshared',
+                         loadTimeData.getString('screenLockShared'));
       } else {
         $('import-data').onclick = function(event) {
           ImportDataOverlay.show();
@@ -247,6 +265,9 @@ cr.define('options', function() {
 
       // Default browser section.
       if (!cr.isChromeOS) {
+        if (!loadTimeData.getBoolean('showSetDefault')) {
+          $('set-default-browser-section').hidden = true;
+        }
         $('set-as-default-browser').onclick = function(event) {
           chrome.send('becomeDefaultBrowser');
         };
@@ -457,9 +478,6 @@ cr.define('options', function() {
         Preferences.getInstance().addEventListener(
             $('accessibility-autoclick-check').getAttribute('pref'),
             updateDelayDropdown);
-
-        $('accessibility-sticky-keys').hidden =
-            !loadTimeData.getBoolean('enableStickyKeys');
       }
 
       // Display management section (CrOS only).
@@ -620,7 +638,7 @@ cr.define('options', function() {
      * See showSectionWithAnimation_.
      */
     toggleSectionWithAnimation_: function(section, container) {
-      if (section.style.height == '')
+      if (section.style.height == '' || section.style.height == '0px')
         this.showSectionWithAnimation_(section, container);
       else
         this.hideSectionWithAnimation_(section, container);
@@ -730,10 +748,15 @@ cr.define('options', function() {
       if (!syncData.signinAllowed &&
           (!syncData.supervisedUser || !cr.isChromeOS)) {
         $('sync-section').hidden = true;
+        $('sync-users-section').hidden =
+            $('profiles-section').hidden &&
+            $('sync-section').hidden &&
+            $('profiles-supervised-dashboard-tip').hidden;
         return;
       }
 
       $('sync-section').hidden = false;
+      $('sync-users-section').hidden = false;
 
       var subSection = $('sync-section').firstChild;
       while (subSection) {
@@ -849,7 +872,15 @@ cr.define('options', function() {
      *     users.
      */
     updateManagesSupervisedUsers_: function(value) {
-      $('profiles-supervised-dashboard-tip').hidden = !value;
+      if (value) {
+        $('profiles-supervised-dashboard-tip').hidden = false;
+      } else {
+        $('profiles-supervised-dashboard-tip').hidden = true;
+      }
+      $('sync-users-section').hidden =
+          $('profiles-section').hidden &&
+          $('sync-section').hidden &&
+          $('profiles-supervised-dashboard-tip').hidden;
     },
 
     /**
@@ -890,24 +921,6 @@ cr.define('options', function() {
     },
 
     /**
-     * Event listener for the 'hotword search enabled' preference. Shows/hides
-     * the UI for updating hotword settings..
-     * @param {Event} event The preference change event.
-     */
-    onHotwordSearchPrefChanged_: function(event) {
-      var section = $('hotword-settings-section');
-      var container = $('hotword-settings-section-container');
-      // event.value is a dictionary with details about the preference that was
-      // changed. Within that dictionary, |value| is the new value of the
-      // preference. In this case, the preference represents a Boolean so it
-      // can be checked for true/false.
-      if (event.value.value)
-        this.showSectionWithAnimation_(section, container);
-      else
-        this.hideSectionWithAnimation_(section, container);
-    },
-
-    /**
      * Event listener for the 'homepage is NTP' preference. Updates the label
      * next to the 'Change' button.
      * @param {Event} event The preference change event.
@@ -958,12 +971,13 @@ cr.define('options', function() {
     onDefaultDownloadDirectoryChanged_: function(event) {
       $('downloadLocationPath').value = event.value.value;
       if (cr.isChromeOS) {
-        // On ChromeOS, replace /special/drive/root with Drive for drive paths,
-        // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads
-        // with Downloads for local paths, and '/' with ' \u203a ' (angled quote
-        // sign) everywhere. The modified path is used only for display purpose.
+        // On ChromeOS, replace /special/drive-<hash>/root with "Google Drive"
+        // for remote files, /home/chronos/user/Downloads or
+        // /home/chronos/u-<hash>/Downloads with "Downloads" for local paths,
+        // and '/' with ' \u203a ' (angled quote sign) everywhere. The modified
+        // path is used only for display purpose.
         var path = $('downloadLocationPath').value;
-        path = path.replace(/^\/special\/drive\/root/, 'Google Drive');
+        path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive');
         path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, '');
         path = path.replace(/\//g, ' \u203a ');
         $('downloadLocationPath').value = path;