| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
| 8 | 8 |
| 9 // | 9 // |
| 10 // AdvancedOptions class | 10 // AdvancedOptions class |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 initializePage: function() { | 27 initializePage: function() { |
| 28 // Call base class implementation to starts preference initialization. | 28 // Call base class implementation to starts preference initialization. |
| 29 OptionsPage.prototype.initializePage.call(this); | 29 OptionsPage.prototype.initializePage.call(this); |
| 30 | 30 |
| 31 $('advanced-section-back-button').onclick = | 31 $('advanced-section-back-button').onclick = |
| 32 OptionsPage.navigateToPage.bind(OptionsPage, this.parentPage.name); | 32 OptionsPage.navigateToPage.bind(OptionsPage, this.parentPage.name); |
| 33 | 33 |
| 34 // Date and time section (CrOS only). | 34 // Date and time section (CrOS only). |
| 35 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { | 35 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
| 36 // Disable time-related settings if we're not logged in as a real user. | 36 // Disable time-related settings if we're not logged in as a real user. |
| 37 $('timezone-select').disabled = true; | 37 AccountsOptions.disableElementsForGuest($('timezone-value-group')); |
| 38 $('use-24hour-clock').disabled = true; | 38 AccountsOptions.disableElementsForGuest($('use-24hour-clock')); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Privacy section. | 41 // Privacy section. |
| 42 $('privacyContentSettingsButton').onclick = function(event) { | 42 $('privacyContentSettingsButton').onclick = function(event) { |
| 43 OptionsPage.navigateToPage('content'); | 43 OptionsPage.navigateToPage('content'); |
| 44 OptionsPage.showTab($('cookies-nav-tab')); | 44 OptionsPage.showTab($('cookies-nav-tab')); |
| 45 chrome.send('coreOptionsUserMetricsAction', | 45 chrome.send('coreOptionsUserMetricsAction', |
| 46 ['Options_ContentSettings']); | 46 ['Options_ContentSettings']); |
| 47 }; | 47 }; |
| 48 $('privacyClearDataButton').onclick = function(event) { | 48 $('privacyClearDataButton').onclick = function(event) { |
| 49 OptionsPage.navigateToPage('clearBrowserData'); | 49 OptionsPage.navigateToPage('clearBrowserData'); |
| 50 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 50 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
| 51 }; | 51 }; |
| 52 // 'metricsReportingEnabled' element is only present on Chrome branded | 52 // 'metricsReportingEnabled' element is only present on Chrome branded |
| 53 // builds. | 53 // builds. |
| 54 if ($('metricsReportingEnabled')) { | 54 if ($('metricsReportingEnabled')) { |
| 55 $('metricsReportingEnabled').onclick = function(event) { | 55 $('metricsReportingEnabled').onclick = function(event) { |
| 56 chrome.send('metricsReportingCheckboxAction', | 56 chrome.send('metricsReportingCheckboxAction', |
| 57 [String(event.target.checked)]); | 57 [String(event.target.checked)]); |
| 58 }; | 58 }; |
| 59 } | 59 } |
| 60 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
| 61 AccountsOptions.disableElementsForGuest( |
| 62 $('search-suggest-enabled-group')); |
| 63 AccountsOptions.disableElementsForGuest( |
| 64 $('dns-prefetching-enabled-group')); |
| 65 } |
| 60 | 66 |
| 61 // Bluetooth (CrOS only). | 67 // Bluetooth (CrOS only). |
| 62 if (cr.isChromeOS) { | 68 if (cr.isChromeOS) { |
| 63 options.system.bluetooth.BluetoothDeviceList.decorate( | 69 options.system.bluetooth.BluetoothDeviceList.decorate( |
| 64 $('bluetooth-paired-devices-list')); | 70 $('bluetooth-paired-devices-list')); |
| 65 | 71 |
| 66 $('bluetooth-add-device').onclick = function(event) { | 72 $('bluetooth-add-device').onclick = function(event) { |
| 67 findBluetoothDevices_(true); | 73 findBluetoothDevices_(true); |
| 68 OptionsPage.navigateToPage('bluetooth'); | 74 OptionsPage.navigateToPage('bluetooth'); |
| 69 }; | 75 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 99 OptionsPage.navigateToPage('autofill'); | 105 OptionsPage.navigateToPage('autofill'); |
| 100 chrome.send('coreOptionsUserMetricsAction', | 106 chrome.send('coreOptionsUserMetricsAction', |
| 101 ['Options_ShowAutofillSettings']); | 107 ['Options_ShowAutofillSettings']); |
| 102 }; | 108 }; |
| 103 $('manage-passwords').onclick = function(event) { | 109 $('manage-passwords').onclick = function(event) { |
| 104 OptionsPage.navigateToPage('passwords'); | 110 OptionsPage.navigateToPage('passwords'); |
| 105 OptionsPage.showTab($('passwords-nav-tab')); | 111 OptionsPage.showTab($('passwords-nav-tab')); |
| 106 chrome.send('coreOptionsUserMetricsAction', | 112 chrome.send('coreOptionsUserMetricsAction', |
| 107 ['Options_ShowPasswordManager']); | 113 ['Options_ShowPasswordManager']); |
| 108 }; | 114 }; |
| 109 if (AdvancedOptions.GuestModeActive()) { | 115 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
| 110 // Disable and turn off Autofill in guest mode. | 116 // Disable and turn off Autofill in guest mode. |
| 111 var autofillEnabled = $('autofill-enabled'); | 117 var autofillEnabled = $('autofill-enabled'); |
| 112 autofillEnabled.disabled = true; | 118 autofillEnabled.disabled = true; |
| 113 autofillEnabled.checked = false; | 119 autofillEnabled.checked = false; |
| 114 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 120 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
| 115 $('autofill-settings').disabled = true; | 121 $('autofill-settings').disabled = true; |
| 116 | 122 |
| 117 // Disable and turn off Password Manager in guest mode. | 123 // Disable and turn off Password Manager in guest mode. |
| 118 var passwordManagerEnabled = $('password-manager-enabled'); | 124 var passwordManagerEnabled = $('password-manager-enabled'); |
| 119 passwordManagerEnabled.disabled = true; | 125 passwordManagerEnabled.disabled = true; |
| 120 passwordManagerEnabled.checked = false; | 126 passwordManagerEnabled.checked = false; |
| 121 cr.dispatchSimpleEvent(passwordManagerEnabled, 'change'); | 127 cr.dispatchSimpleEvent(passwordManagerEnabled, 'change'); |
| 122 $('manage-passwords').disabled = true; | 128 $('manage-passwords').disabled = true; |
| 123 | 129 |
| 124 // Hide the entire section on ChromeOS | 130 // Hide the entire section on ChromeOS |
| 125 if (cr.isChromeOS) | 131 AccountsOptions.disableElementsForGuest( |
| 126 $('passwords-and-autofill-section').hidden = true; | 132 $('passwords-and-autofill-section')); |
| 127 } | 133 } |
| 134 |
| 128 $('mac-passwords-warning').hidden = | 135 $('mac-passwords-warning').hidden = |
| 129 !(localStrings.getString('macPasswordsWarning')); | 136 !(localStrings.getString('macPasswordsWarning')); |
| 130 | 137 |
| 131 // Network section. | 138 // Network section. |
| 132 if (!cr.isChromeOS) { | 139 if (!cr.isChromeOS) { |
| 133 $('proxiesConfigureButton').onclick = function(event) { | 140 $('proxiesConfigureButton').onclick = function(event) { |
| 134 chrome.send('showNetworkProxySettings'); | 141 chrome.send('showNetworkProxySettings'); |
| 135 }; | 142 }; |
| 136 } | 143 } |
| 137 | 144 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 }; | 260 }; |
| 254 | 261 |
| 255 AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) { | 262 AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) { |
| 256 if (visible) { | 263 if (visible) { |
| 257 $('metricsReportingSetting').style.display = 'block'; | 264 $('metricsReportingSetting').style.display = 'block'; |
| 258 } else { | 265 } else { |
| 259 $('metricsReportingSetting').style.display = 'none'; | 266 $('metricsReportingSetting').style.display = 'none'; |
| 260 } | 267 } |
| 261 }; | 268 }; |
| 262 | 269 |
| 263 /** | |
| 264 * Returns whether the browser in guest mode. Some features are disabled or | |
| 265 * hidden in guest mode. | |
| 266 * @return {boolean} True if guest mode is currently active. | |
| 267 */ | |
| 268 AdvancedOptions.GuestModeActive = function() { | |
| 269 return cr.commandLine && cr.commandLine.options['--bwsi']; | |
| 270 }; | |
| 271 | |
| 272 // Set the font size selected item. | 270 // Set the font size selected item. |
| 273 AdvancedOptions.SetFontSize = function(font_size_value) { | 271 AdvancedOptions.SetFontSize = function(font_size_value) { |
| 274 var selectCtl = $('defaultFontSize'); | 272 var selectCtl = $('defaultFontSize'); |
| 275 for (var i = 0; i < selectCtl.options.length; i++) { | 273 for (var i = 0; i < selectCtl.options.length; i++) { |
| 276 if (selectCtl.options[i].value == font_size_value) { | 274 if (selectCtl.options[i].value == font_size_value) { |
| 277 selectCtl.selectedIndex = i; | 275 selectCtl.selectedIndex = i; |
| 278 if ($('Custom')) | 276 if ($('Custom')) |
| 279 selectCtl.remove($('Custom').index); | 277 selectCtl.remove($('Custom').index); |
| 280 return; | 278 return; |
| 281 } | 279 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 if (device.pairing) | 453 if (device.pairing) |
| 456 BluetoothPairing.showDialog(device); | 454 BluetoothPairing.showDialog(device); |
| 457 }; | 455 }; |
| 458 | 456 |
| 459 // Export | 457 // Export |
| 460 return { | 458 return { |
| 461 AdvancedOptions: AdvancedOptions | 459 AdvancedOptions: AdvancedOptions |
| 462 }; | 460 }; |
| 463 | 461 |
| 464 }); | 462 }); |
| OLD | NEW |