Chromium Code Reviews| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * childUser: (boolean|undefined), | 9 * childUser: (boolean|undefined), |
| 10 * hasError: (boolean|undefined), | 10 * hasError: (boolean|undefined), |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Track if page initialization is complete. All C++ UI handlers have the | 104 * Track if page initialization is complete. All C++ UI handlers have the |
| 105 * chance to manipulate page content within their InitializePage methods. | 105 * chance to manipulate page content within their InitializePage methods. |
| 106 * This flag is set to true after all initializers have been called. | 106 * This flag is set to true after all initializers have been called. |
| 107 * @type {boolean} | 107 * @type {boolean} |
| 108 * @private | 108 * @private |
| 109 */ | 109 */ |
| 110 initializationComplete_: false, | 110 initializationComplete_: false, |
| 111 | 111 |
| 112 /** | |
| 113 * Current status of "Resolve Timezone by Geolocation" checkbox. | |
|
michaelpg
2015/07/20 21:40:51
Annotate: @private {boolean}
Alexander Alekseev
2015/07/21 05:34:29
Done.
| |
| 114 */ | |
| 115 resolveTimezoneByGeolocation_: false, | |
| 116 | |
| 117 /** | |
| 118 * True if system timezone is managed by policy. | |
|
michaelpg
2015/07/20 21:40:51
Annotate.
Alexander Alekseev
2015/07/21 05:34:29
Done.
| |
| 119 */ | |
| 120 systemTimezoneIsManaged_: false, | |
| 121 | |
| 112 /** @override */ | 122 /** @override */ |
| 113 initializePage: function() { | 123 initializePage: function() { |
| 114 Page.prototype.initializePage.call(this); | 124 Page.prototype.initializePage.call(this); |
| 115 var self = this; | 125 var self = this; |
| 116 | 126 |
| 117 if (window.top != window) { | 127 if (window.top != window) { |
| 118 // The options page is not in its own window. | 128 // The options page is not in its own window. |
| 119 document.body.classList.add('uber-frame'); | 129 document.body.classList.add('uber-frame'); |
| 120 PageManager.horizontalOffset = 155; | 130 PageManager.horizontalOffset = 155; |
| 121 } | 131 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 } | 410 } |
| 401 | 411 |
| 402 // Date and time section (CrOS only). | 412 // Date and time section (CrOS only). |
| 403 if (cr.isChromeOS) { | 413 if (cr.isChromeOS) { |
| 404 if ($('set-time-button')) | 414 if ($('set-time-button')) |
| 405 $('set-time-button').onclick = this.handleSetTime_.bind(this); | 415 $('set-time-button').onclick = this.handleSetTime_.bind(this); |
| 406 | 416 |
| 407 // Timezone | 417 // Timezone |
| 408 if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) { | 418 if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) { |
| 409 $('resolve-timezone-by-geolocation-selection').hidden = false; | 419 $('resolve-timezone-by-geolocation-selection').hidden = false; |
| 410 this.setSystemTimezoneManaged_(false); | |
| 411 $('timezone-value-select').disabled = loadTimeData.getBoolean( | |
| 412 'resolveTimezoneByGeolocationInitialValue'); | |
| 413 } | 420 } |
| 414 } | 421 } |
| 415 | 422 |
| 416 // Default browser section. | 423 // Default browser section. |
| 417 if (!cr.isChromeOS) { | 424 if (!cr.isChromeOS) { |
| 418 if (!loadTimeData.getBoolean('showSetDefault')) { | 425 if (!loadTimeData.getBoolean('showSetDefault')) { |
| 419 $('set-default-browser-section').hidden = true; | 426 $('set-default-browser-section').hidden = true; |
| 420 } | 427 } |
| 421 $('set-as-default-browser').onclick = function(event) { | 428 $('set-as-default-browser').onclick = function(event) { |
| 422 chrome.send('becomeDefaultBrowser'); | 429 chrome.send('becomeDefaultBrowser'); |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1645 this.enableElementIfPossible_(getRequiredElement('set-wallpaper')); | 1652 this.enableElementIfPossible_(getRequiredElement('set-wallpaper')); |
| 1646 | 1653 |
| 1647 // Create a synthetic pref change event decorated as | 1654 // Create a synthetic pref change event decorated as |
| 1648 // CoreOptionsHandler::CreateValueForPref() does. | 1655 // CoreOptionsHandler::CreateValueForPref() does. |
| 1649 var event = new Event('wallpaper'); | 1656 var event = new Event('wallpaper'); |
| 1650 event.value = managed ? { controlledBy: 'policy' } : {}; | 1657 event.value = managed ? { controlledBy: 'policy' } : {}; |
| 1651 $('wallpaper-indicator').handlePrefChange(event); | 1658 $('wallpaper-indicator').handlePrefChange(event); |
| 1652 }, | 1659 }, |
| 1653 | 1660 |
| 1654 /** | 1661 /** |
| 1655 * This is called from chromium code when system timezone "managed" state | 1662 * This enables or disables dependent settings in timezone section. |
| 1656 * is changed. Enables or disables dependent settings. | 1663 * @private |
| 1657 * @param {boolean} managed Is true when system Timezone is managed by | |
| 1658 * enterprise policy. False otherwize. | |
| 1659 */ | 1664 */ |
| 1660 setSystemTimezoneManaged_: function(managed) { | 1665 updateTimezoneSectionVisibility_: function() { |
|
michaelpg
2015/07/20 21:40:51
rename: this changes enabled state, not visibility
Alexander Alekseev
2015/07/21 05:34:29
Done.
| |
| 1661 if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) { | 1666 if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) { |
| 1662 if (managed) { | 1667 if (this.systemTimezoneIsManaged_) { |
|
michaelpg
2015/07/20 21:40:51
If this is only used here, can you make it a param
Alexander Alekseev
2015/07/21 05:34:29
Done.
michaelpg
2015/07/21 23:47:36
Sorry, I think my logic was wrong! There are 2 var
| |
| 1663 $('resolve-timezone-by-geolocation-selection').disabled = true; | 1668 $('resolve-timezone-by-geolocation-selection').disabled = true; |
| 1664 $('resolve-timezone-by-geolocation').onclick = function(event) {}; | 1669 $('resolve-timezone-by-geolocation').onclick = function(event) {}; |
| 1665 } else { | 1670 } else { |
| 1666 this.enableElementIfPossible_( | 1671 this.enableElementIfPossible_( |
| 1667 getRequiredElement('resolve-timezone-by-geolocation-selection')); | 1672 getRequiredElement('resolve-timezone-by-geolocation-selection')); |
| 1668 $('resolve-timezone-by-geolocation').onclick = function(event) { | 1673 $('resolve-timezone-by-geolocation').onclick = function(event) { |
| 1669 $('timezone-value-select').disabled = event.currentTarget.checked; | 1674 $('timezone-value-select').disabled = event.currentTarget.checked; |
| 1670 }; | 1675 }; |
| 1671 $('timezone-value-select').disabled = | 1676 $('timezone-value-select').disabled = |
| 1672 $('resolve-timezone-by-geolocation').checked; | 1677 this.resolveTimezoneByGeolocation_; |
|
michaelpg
2015/07/20 21:40:51
Same request.
Alexander Alekseev
2015/07/21 05:34:29
Done.
| |
| 1673 } | 1678 } |
| 1674 } | 1679 } |
| 1675 }, | 1680 }, |
| 1676 | 1681 |
| 1677 /** | 1682 /** |
| 1683 * This is called from chromium code when system timezone "managed" state | |
| 1684 * is changed. Enables or disables dependent settings. | |
| 1685 * @param {boolean} managed Is true when system Timezone is managed by | |
| 1686 * enterprise policy. False otherwize. | |
| 1687 */ | |
| 1688 setSystemTimezoneManaged_: function(managed) { | |
| 1689 this.systemTimezoneIsManaged_ = managed; | |
| 1690 this.updateTimezoneSectionVisibility_(); | |
| 1691 }, | |
| 1692 | |
| 1693 /** | |
| 1694 * This is called from chromium code when kResolveTimezoneByGeolocation | |
| 1695 * preference is changed. Enables or disables dependent settings. | |
| 1696 * @param {boolean} value Is true or false when | |
| 1697 * kResolveTimezoneByGeolocation preference is true or false. | |
|
michaelpg
2015/07/20 21:40:51
nit: indent 4 spaces
Alexander Alekseev
2015/07/21 05:34:29
Done.
| |
| 1698 */ | |
| 1699 onResolveTimezoneByGeolocationChanged_: function(value) { | |
|
michaelpg
2015/07/20 21:40:51
This is a plain preference, so you can trigger thi
Alexander Alekseev
2015/07/21 05:34:29
This is what I was looking for! Thank you.
| |
| 1700 this.resolveTimezoneByGeolocation_ = value; | |
| 1701 this.updateTimezoneSectionVisibility_(); | |
| 1702 }, | |
| 1703 | |
| 1704 /** | |
| 1678 * Handle the 'add device' button click. | 1705 * Handle the 'add device' button click. |
| 1679 * @private | 1706 * @private |
| 1680 */ | 1707 */ |
| 1681 handleAddBluetoothDevice_: function() { | 1708 handleAddBluetoothDevice_: function() { |
| 1682 chrome.send('coreOptionsUserMetricsAction', | 1709 chrome.send('coreOptionsUserMetricsAction', |
| 1683 ['Options_BluetoothShowAddDevice']); | 1710 ['Options_BluetoothShowAddDevice']); |
| 1684 chrome.send('findBluetoothDevices'); | 1711 chrome.send('findBluetoothDevices'); |
| 1685 PageManager.showPageByName('bluetooth', false); | 1712 PageManager.showPageByName('bluetooth', false); |
| 1686 }, | 1713 }, |
| 1687 | 1714 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2139 cr.makePublic(BrowserOptions, [ | 2166 cr.makePublic(BrowserOptions, [ |
| 2140 'addBluetoothDevice', | 2167 'addBluetoothDevice', |
| 2141 'deleteCurrentProfile', | 2168 'deleteCurrentProfile', |
| 2142 'enableCertificateButton', | 2169 'enableCertificateButton', |
| 2143 'enableDisplaySettings', | 2170 'enableDisplaySettings', |
| 2144 'enableFactoryResetSection', | 2171 'enableFactoryResetSection', |
| 2145 'getCurrentProfile', | 2172 'getCurrentProfile', |
| 2146 'getStartStopSyncButton', | 2173 'getStartStopSyncButton', |
| 2147 'hideBluetoothSettings', | 2174 'hideBluetoothSettings', |
| 2148 'notifyInitializationComplete', | 2175 'notifyInitializationComplete', |
| 2176 'onResolveTimezoneByGeolocationChanged', | |
| 2149 'removeBluetoothDevice', | 2177 'removeBluetoothDevice', |
| 2150 'scrollToSection', | 2178 'scrollToSection', |
| 2151 'setAccountPictureManaged', | 2179 'setAccountPictureManaged', |
| 2152 'setWallpaperManaged', | 2180 'setWallpaperManaged', |
| 2153 'setAutoOpenFileTypesDisplayed', | 2181 'setAutoOpenFileTypesDisplayed', |
| 2154 'setBluetoothState', | 2182 'setBluetoothState', |
| 2155 'setCanSetTime', | 2183 'setCanSetTime', |
| 2156 'setFontSize', | 2184 'setFontSize', |
| 2157 'setHotwordRetrainLinkVisible', | 2185 'setHotwordRetrainLinkVisible', |
| 2158 'setNativeThemeButtonEnabled', | 2186 'setNativeThemeButtonEnabled', |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2237 } | 2265 } |
| 2238 button.textContent = loadTimeData.getString(strId); | 2266 button.textContent = loadTimeData.getString(strId); |
| 2239 }; | 2267 }; |
| 2240 } | 2268 } |
| 2241 | 2269 |
| 2242 // Export | 2270 // Export |
| 2243 return { | 2271 return { |
| 2244 BrowserOptions: BrowserOptions | 2272 BrowserOptions: BrowserOptions |
| 2245 }; | 2273 }; |
| 2246 }); | 2274 }); |
| OLD | NEW |