| 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 20 matching lines...) Expand all Loading... |
| 31 * @typedef {{name: string, | 31 * @typedef {{name: string, |
| 32 * filePath: string, | 32 * filePath: string, |
| 33 * isCurrentProfile: boolean, | 33 * isCurrentProfile: boolean, |
| 34 * isSupervised: boolean, | 34 * isSupervised: boolean, |
| 35 * isChild: boolean, | 35 * isChild: boolean, |
| 36 * iconUrl: string}} | 36 * iconUrl: string}} |
| 37 * @see chrome/browser/ui/webui/options/browser_options_handler.cc | 37 * @see chrome/browser/ui/webui/options/browser_options_handler.cc |
| 38 */ | 38 */ |
| 39 options.Profile; | 39 options.Profile; |
| 40 | 40 |
| 41 /** |
| 42 * Device policy SystemTimezoneAutomaticDetection values. |
| 43 * @enum {number} |
| 44 * @const |
| 45 */ |
| 46 options.AutomaticTimezoneDetectionType = { |
| 47 USERS_DECIDE: 0, |
| 48 DISABLED: 1, |
| 49 IP_ONLY: 2, |
| 50 SEND_WIFI_ACCESS_POINTS: 3, |
| 51 }; |
| 52 |
| 41 cr.define('options', function() { | 53 cr.define('options', function() { |
| 42 var OptionsPage = options.OptionsPage; | 54 var OptionsPage = options.OptionsPage; |
| 43 var Page = cr.ui.pageManager.Page; | 55 var Page = cr.ui.pageManager.Page; |
| 44 var PageManager = cr.ui.pageManager.PageManager; | 56 var PageManager = cr.ui.pageManager.PageManager; |
| 45 var ArrayDataModel = cr.ui.ArrayDataModel; | 57 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 46 var RepeatingButton = cr.ui.RepeatingButton; | 58 var RepeatingButton = cr.ui.RepeatingButton; |
| 47 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 59 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
| 48 var NetworkPredictionOptions = { | 60 var NetworkPredictionOptions = { |
| 49 ALWAYS: 0, | 61 ALWAYS: 0, |
| 50 WIFI_ONLY: 1, | 62 WIFI_ONLY: 1, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 */ | 123 */ |
| 112 resolveTimezoneByGeolocation_: false, | 124 resolveTimezoneByGeolocation_: false, |
| 113 | 125 |
| 114 /** | 126 /** |
| 115 * True if system timezone is managed by policy. | 127 * True if system timezone is managed by policy. |
| 116 * @private {boolean} | 128 * @private {boolean} |
| 117 */ | 129 */ |
| 118 systemTimezoneIsManaged_: false, | 130 systemTimezoneIsManaged_: false, |
| 119 | 131 |
| 120 /** | 132 /** |
| 133 * True if system timezone detection is managed by policy. |
| 134 * @private {boolean} |
| 135 */ |
| 136 systemTimezoneAutomaticDetectionIsManaged_: false, |
| 137 |
| 138 /** |
| 139 * This is the value of SystemTimezoneAutomaticDetection policy. |
| 140 * @private {number} |
| 141 */ |
| 142 systemTimezoneAutomaticDetectionValue_: 0, |
| 143 |
| 144 /** |
| 121 * Cached bluetooth adapter state. | 145 * Cached bluetooth adapter state. |
| 122 * @private {?chrome.bluetooth.AdapterState} | 146 * @private {?chrome.bluetooth.AdapterState} |
| 123 */ | 147 */ |
| 124 bluetoothAdapterState_: null, | 148 bluetoothAdapterState_: null, |
| 125 | 149 |
| 126 /** @override */ | 150 /** @override */ |
| 127 initializePage: function() { | 151 initializePage: function() { |
| 128 Page.prototype.initializePage.call(this); | 152 Page.prototype.initializePage.call(this); |
| 129 var self = this; | 153 var self = this; |
| 130 | 154 |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 var event = new Event('wallpaper'); | 1698 var event = new Event('wallpaper'); |
| 1675 event.value = managed ? { controlledBy: 'policy' } : {}; | 1699 event.value = managed ? { controlledBy: 'policy' } : {}; |
| 1676 $('wallpaper-indicator').handlePrefChange(event); | 1700 $('wallpaper-indicator').handlePrefChange(event); |
| 1677 }, | 1701 }, |
| 1678 | 1702 |
| 1679 /** | 1703 /** |
| 1680 * This enables or disables dependent settings in timezone section. | 1704 * This enables or disables dependent settings in timezone section. |
| 1681 * @private | 1705 * @private |
| 1682 */ | 1706 */ |
| 1683 updateTimezoneSectionState_: function() { | 1707 updateTimezoneSectionState_: function() { |
| 1708 var self = this; |
| 1709 $('resolve-timezone-by-geolocation') |
| 1710 .onclick = function(event) { |
| 1711 self.resolveTimezoneByGeolocation_ = event.currentTarget.checked; |
| 1712 }; |
| 1684 if (this.systemTimezoneIsManaged_) { | 1713 if (this.systemTimezoneIsManaged_) { |
| 1685 $('resolve-timezone-by-geolocation-selection').disabled = true; | 1714 $('resolve-timezone-by-geolocation').disabled = true; |
| 1686 $('resolve-timezone-by-geolocation').onclick = function(event) {}; | 1715 $('resolve-timezone-by-geolocation').checked = false; |
| 1716 } else if (this.systemTimezoneAutomaticDetectionIsManaged_) { |
| 1717 if (this.systemTimezoneAutomaticDetectionValue_ == |
| 1718 options.AutomaticTimezoneDetectionType.USERS_DECIDE) { |
| 1719 $('resolve-timezone-by-geolocation').disabled = false; |
| 1720 $('resolve-timezone-by-geolocation') |
| 1721 .checked = this.resolveTimezoneByGeolocation_; |
| 1722 $('timezone-value-select') |
| 1723 .disabled = this.resolveTimezoneByGeolocation_; |
| 1724 } else { |
| 1725 $('resolve-timezone-by-geolocation').disabled = true; |
| 1726 $('resolve-timezone-by-geolocation') |
| 1727 .checked = |
| 1728 (this.systemTimezoneAutomaticDetectionValue_ != |
| 1729 options.AutomaticTimezoneDetectionType.DISABLED); |
| 1730 $('timezone-value-select').disabled = true; |
| 1731 } |
| 1687 } else { | 1732 } else { |
| 1688 this.enableElementIfPossible_( | 1733 this.enableElementIfPossible_( |
| 1689 getRequiredElement('resolve-timezone-by-geolocation-selection')); | 1734 getRequiredElement('resolve-timezone-by-geolocation')); |
| 1690 $('resolve-timezone-by-geolocation').onclick = function(event) { | |
| 1691 $('timezone-value-select').disabled = event.currentTarget.checked; | |
| 1692 }; | |
| 1693 $('timezone-value-select').disabled = | 1735 $('timezone-value-select').disabled = |
| 1694 this.resolveTimezoneByGeolocation_; | 1736 this.resolveTimezoneByGeolocation_; |
| 1737 $('resolve-timezone-by-geolocation') |
| 1738 .checked = this.resolveTimezoneByGeolocation_; |
| 1695 } | 1739 } |
| 1696 }, | 1740 }, |
| 1697 | 1741 |
| 1698 /** | 1742 /** |
| 1699 * This is called from chromium code when system timezone "managed" state | 1743 * This is called from chromium code when system timezone "managed" state |
| 1700 * is changed. Enables or disables dependent settings. | 1744 * is changed. Enables or disables dependent settings. |
| 1701 * @param {boolean} managed Is true when system Timezone is managed by | 1745 * @param {boolean} managed Is true when system Timezone is managed by |
| 1702 * enterprise policy. False otherwize. | 1746 * enterprise policy. False otherwize. |
| 1703 */ | 1747 */ |
| 1704 setSystemTimezoneManaged_: function(managed) { | 1748 setSystemTimezoneManaged_: function(managed) { |
| 1705 this.systemTimezoneIsManaged_ = managed; | 1749 this.systemTimezoneIsManaged_ = managed; |
| 1706 this.updateTimezoneSectionState_(); | 1750 this.updateTimezoneSectionState_(); |
| 1707 }, | 1751 }, |
| 1708 | 1752 |
| 1709 /** | 1753 /** |
| 1754 * This is called from chromium code when system timezone detection |
| 1755 * "managed" state is changed. Enables or disables dependent settings. |
| 1756 * @param {boolean} managed Is true when system timezone autodetection is |
| 1757 * managed by enterprise policy. False otherwize. |
| 1758 * @param {options.AutomaticTimezoneDetectionType} value Current value of |
| 1759 * SystemTimezoneAutomaticDetection device policy. |
| 1760 */ |
| 1761 setSystemTimezoneAutomaticDetectionManaged_: function(managed, value) { |
| 1762 this.systemTimezoneAutomaticDetectionIsManaged_ = managed; |
| 1763 this.systemTimezoneAutomaticDetectionValue_ = value; |
| 1764 this.updateTimezoneSectionState_(); |
| 1765 }, |
| 1766 |
| 1767 /** |
| 1710 * This is Preferences event listener, which is called when | 1768 * This is Preferences event listener, which is called when |
| 1711 * kResolveTimezoneByGeolocation preference is changed. | 1769 * kResolveTimezoneByGeolocation preference is changed. |
| 1712 * Enables or disables dependent settings. | 1770 * Enables or disables dependent settings. |
| 1713 * @param {Event} value New preference state. | 1771 * @param {Event} value New preference state. |
| 1714 */ | 1772 */ |
| 1715 onResolveTimezoneByGeolocationChanged_: function(value) { | 1773 onResolveTimezoneByGeolocationChanged_: function(value) { |
| 1716 this.resolveTimezoneByGeolocation_ = value.value.value; | 1774 this.resolveTimezoneByGeolocation_ = value.value.value; |
| 1717 this.updateTimezoneSectionState_(); | 1775 this.updateTimezoneSectionState_(); |
| 1718 }, | 1776 }, |
| 1719 | 1777 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 'setNativeThemeButtonEnabled', | 2306 'setNativeThemeButtonEnabled', |
| 2249 'setNetworkPredictionValue', | 2307 'setNetworkPredictionValue', |
| 2250 'setNowSectionVisible', | 2308 'setNowSectionVisible', |
| 2251 'setHighContrastCheckboxState', | 2309 'setHighContrastCheckboxState', |
| 2252 'setAllHotwordSectionsVisible', | 2310 'setAllHotwordSectionsVisible', |
| 2253 'setMetricsReportingCheckboxState', | 2311 'setMetricsReportingCheckboxState', |
| 2254 'setMetricsReportingSettingVisibility', | 2312 'setMetricsReportingSettingVisibility', |
| 2255 'setProfilesInfo', | 2313 'setProfilesInfo', |
| 2256 'setSpokenFeedbackCheckboxState', | 2314 'setSpokenFeedbackCheckboxState', |
| 2257 'setSystemTimezoneManaged', | 2315 'setSystemTimezoneManaged', |
| 2316 'setSystemTimezoneAutomaticDetectionManaged', |
| 2258 'setThemesResetButtonEnabled', | 2317 'setThemesResetButtonEnabled', |
| 2259 'setVirtualKeyboardCheckboxState', | 2318 'setVirtualKeyboardCheckboxState', |
| 2260 'setupPageZoomSelector', | 2319 'setupPageZoomSelector', |
| 2261 'setupProxySettingsButton', | 2320 'setupProxySettingsButton', |
| 2262 'setAudioHistorySectionVisible', | 2321 'setAudioHistorySectionVisible', |
| 2263 'showCreateProfileError', | 2322 'showCreateProfileError', |
| 2264 'showCreateProfileSuccess', | 2323 'showCreateProfileSuccess', |
| 2265 'showCreateProfileWarning', | 2324 'showCreateProfileWarning', |
| 2266 'showHotwordAlwaysOnSection', | 2325 'showHotwordAlwaysOnSection', |
| 2267 'showHotwordNoDspSection', | 2326 'showHotwordNoDspSection', |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2335 if (section) | 2394 if (section) |
| 2336 section.hidden = true; | 2395 section.hidden = true; |
| 2337 }; | 2396 }; |
| 2338 } | 2397 } |
| 2339 | 2398 |
| 2340 // Export | 2399 // Export |
| 2341 return { | 2400 return { |
| 2342 BrowserOptions: BrowserOptions | 2401 BrowserOptions: BrowserOptions |
| 2343 }; | 2402 }; |
| 2344 }); | 2403 }); |
| OLD | NEW |