Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 1843523002: ChromeOS: Add SystemTimezoneAutomaticDetection policy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@596690--Implement-better-timezone-detection--refactoring-before-policy
Patch Set: Rebased. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 */ 111 */
112 resolveTimezoneByGeolocation_: false, 112 resolveTimezoneByGeolocation_: false,
113 113
114 /** 114 /**
115 * True if system timezone is managed by policy. 115 * True if system timezone is managed by policy.
116 * @private {boolean} 116 * @private {boolean}
117 */ 117 */
118 systemTimezoneIsManaged_: false, 118 systemTimezoneIsManaged_: false,
119 119
120 /** 120 /**
121 * True if system timezone detection is managed by policy.
122 * @private {boolean}
123 */
124 systemTimezoneAutomaticDetectionIsManaged_: false,
125
126 /**
127 * This is the value of SystemTimezoneAutomaticDetection policy.
128 * @private {boolean}
129 */
130 systemTimezoneAutomaticDetectionValue_: 0,
131
132 /**
121 * Cached bluetooth adapter state. 133 * Cached bluetooth adapter state.
122 * @private {?chrome.bluetooth.AdapterState} 134 * @private {?chrome.bluetooth.AdapterState}
123 */ 135 */
124 bluetoothAdapterState_: null, 136 bluetoothAdapterState_: null,
125 137
126 /** @override */ 138 /** @override */
127 initializePage: function() { 139 initializePage: function() {
128 Page.prototype.initializePage.call(this); 140 Page.prototype.initializePage.call(this);
129 var self = this; 141 var self = this;
130 142
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 var event = new Event('wallpaper'); 1686 var event = new Event('wallpaper');
1675 event.value = managed ? { controlledBy: 'policy' } : {}; 1687 event.value = managed ? { controlledBy: 'policy' } : {};
1676 $('wallpaper-indicator').handlePrefChange(event); 1688 $('wallpaper-indicator').handlePrefChange(event);
1677 }, 1689 },
1678 1690
1679 /** 1691 /**
1680 * This enables or disables dependent settings in timezone section. 1692 * This enables or disables dependent settings in timezone section.
1681 * @private 1693 * @private
1682 */ 1694 */
1683 updateTimezoneSectionState_: function() { 1695 updateTimezoneSectionState_: function() {
1696 var self = this;
1697 $('resolve-timezone-by-geolocation')
1698 .onclick = function(event) {
1699 self.resolveTimezoneByGeolocation_ = event.currentTarget.checked;
1700 };
1684 if (this.systemTimezoneIsManaged_) { 1701 if (this.systemTimezoneIsManaged_) {
1685 $('resolve-timezone-by-geolocation-selection').disabled = true; 1702 $('resolve-timezone-by-geolocation').disabled = true;
1686 $('resolve-timezone-by-geolocation').onclick = function(event) {}; 1703 $('resolve-timezone-by-geolocation').checked = false;
1704 } else if (this.systemTimezoneAutomaticDetectionIsManaged_) {
1705 if (this.systemTimezoneAutomaticDetectionValue_ ==
1706 0 /* USERS_DECIDE */) {
1707 $('resolve-timezone-by-geolocation').disabled = false;
1708 $('resolve-timezone-by-geolocation')
1709 .checked = this.resolveTimezoneByGeolocation_;
1710 $('timezone-value-select')
1711 .disabled = this.resolveTimezoneByGeolocation_;
1712 } else {
1713 $('resolve-timezone-by-geolocation').disabled = true;
1714 $('resolve-timezone-by-geolocation')
1715 .checked =
1716 (this.systemTimezoneAutomaticDetectionValue_ != 1 /* DISABLED */);
1717 $('timezone-value-select').disabled = true;
1718 }
1687 } else { 1719 } else {
1688 this.enableElementIfPossible_( 1720 this.enableElementIfPossible_(
1689 getRequiredElement('resolve-timezone-by-geolocation-selection')); 1721 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 = 1722 $('timezone-value-select').disabled =
1694 this.resolveTimezoneByGeolocation_; 1723 this.resolveTimezoneByGeolocation_;
1695 } 1724 }
1696 }, 1725 },
1697 1726
1698 /** 1727 /**
1699 * This is called from chromium code when system timezone "managed" state 1728 * This is called from chromium code when system timezone "managed" state
1700 * is changed. Enables or disables dependent settings. 1729 * is changed. Enables or disables dependent settings.
1701 * @param {boolean} managed Is true when system Timezone is managed by 1730 * @param {boolean} managed Is true when system Timezone is managed by
1702 * enterprise policy. False otherwize. 1731 * enterprise policy. False otherwize.
1703 */ 1732 */
1704 setSystemTimezoneManaged_: function(managed) { 1733 setSystemTimezoneManaged_: function(managed) {
1705 this.systemTimezoneIsManaged_ = managed; 1734 this.systemTimezoneIsManaged_ = managed;
1706 this.updateTimezoneSectionState_(); 1735 this.updateTimezoneSectionState_();
1707 }, 1736 },
1708 1737
1709 /** 1738 /**
1739 * This is called from chromium code when system timezone detection
1740 * "managed" state is changed. Enables or disables dependent settings.
1741 * @param {boolean} managed Is true when system timezone autodetection is
1742 * managed by enterprise policy. False otherwize.
1743 */
1744 setSystemTimezoneAutomaticDetectionManaged_: function(managed, value) {
1745 this.systemTimezoneAutomaticDetectionIsManaged_ = managed;
1746 this.systemTimezoneAutomaticDetectionValue_ = value;
1747 this.updateTimezoneSectionState_();
1748 },
1749
1750 /**
1710 * This is Preferences event listener, which is called when 1751 * This is Preferences event listener, which is called when
1711 * kResolveTimezoneByGeolocation preference is changed. 1752 * kResolveTimezoneByGeolocation preference is changed.
1712 * Enables or disables dependent settings. 1753 * Enables or disables dependent settings.
1713 * @param {Event} value New preference state. 1754 * @param {Event} value New preference state.
1714 */ 1755 */
1715 onResolveTimezoneByGeolocationChanged_: function(value) { 1756 onResolveTimezoneByGeolocationChanged_: function(value) {
1716 this.resolveTimezoneByGeolocation_ = value.value.value; 1757 this.resolveTimezoneByGeolocation_ = value.value.value;
1717 this.updateTimezoneSectionState_(); 1758 this.updateTimezoneSectionState_();
1718 }, 1759 },
1719 1760
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 'setNativeThemeButtonEnabled', 2289 'setNativeThemeButtonEnabled',
2249 'setNetworkPredictionValue', 2290 'setNetworkPredictionValue',
2250 'setNowSectionVisible', 2291 'setNowSectionVisible',
2251 'setHighContrastCheckboxState', 2292 'setHighContrastCheckboxState',
2252 'setAllHotwordSectionsVisible', 2293 'setAllHotwordSectionsVisible',
2253 'setMetricsReportingCheckboxState', 2294 'setMetricsReportingCheckboxState',
2254 'setMetricsReportingSettingVisibility', 2295 'setMetricsReportingSettingVisibility',
2255 'setProfilesInfo', 2296 'setProfilesInfo',
2256 'setSpokenFeedbackCheckboxState', 2297 'setSpokenFeedbackCheckboxState',
2257 'setSystemTimezoneManaged', 2298 'setSystemTimezoneManaged',
2299 'setSystemTimezoneAutomaticDetectionManaged',
2258 'setThemesResetButtonEnabled', 2300 'setThemesResetButtonEnabled',
2259 'setVirtualKeyboardCheckboxState', 2301 'setVirtualKeyboardCheckboxState',
2260 'setupPageZoomSelector', 2302 'setupPageZoomSelector',
2261 'setupProxySettingsButton', 2303 'setupProxySettingsButton',
2262 'setAudioHistorySectionVisible', 2304 'setAudioHistorySectionVisible',
2263 'showCreateProfileError', 2305 'showCreateProfileError',
2264 'showCreateProfileSuccess', 2306 'showCreateProfileSuccess',
2265 'showCreateProfileWarning', 2307 'showCreateProfileWarning',
2266 'showHotwordAlwaysOnSection', 2308 'showHotwordAlwaysOnSection',
2267 'showHotwordNoDspSection', 2309 'showHotwordNoDspSection',
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 if (section) 2376 if (section)
2335 section.hidden = true; 2377 section.hidden = true;
2336 }; 2378 };
2337 } 2379 }
2338 2380
2339 // Export 2381 // Export
2340 return { 2382 return {
2341 BrowserOptions: BrowserOptions 2383 BrowserOptions: BrowserOptions
2342 }; 2384 };
2343 }); 2385 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698