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

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: Update after review. 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}
Dan Beam 2016/04/02 01:39:14 0 isn't a {boolean}
Alexander Alekseev 2016/04/05 08:03:38 Done.
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 */) {
Dan Beam 2016/04/02 01:39:14 can you just put an @enum {number} into this scrip
Alexander Alekseev 2016/04/05 08:03:38 Done.
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_;
1724 $('resolve-timezone-by-geolocation')
1725 .checked = this.resolveTimezoneByGeolocation_;
1695 } 1726 }
1696 }, 1727 },
1697 1728
1698 /** 1729 /**
1699 * This is called from chromium code when system timezone "managed" state 1730 * This is called from chromium code when system timezone "managed" state
1700 * is changed. Enables or disables dependent settings. 1731 * is changed. Enables or disables dependent settings.
1701 * @param {boolean} managed Is true when system Timezone is managed by 1732 * @param {boolean} managed Is true when system Timezone is managed by
1702 * enterprise policy. False otherwize. 1733 * enterprise policy. False otherwize.
1703 */ 1734 */
1704 setSystemTimezoneManaged_: function(managed) { 1735 setSystemTimezoneManaged_: function(managed) {
1705 this.systemTimezoneIsManaged_ = managed; 1736 this.systemTimezoneIsManaged_ = managed;
1706 this.updateTimezoneSectionState_(); 1737 this.updateTimezoneSectionState_();
1707 }, 1738 },
1708 1739
1709 /** 1740 /**
1741 * This is called from chromium code when system timezone detection
1742 * "managed" state is changed. Enables or disables dependent settings.
1743 * @param {boolean} managed Is true when system timezone autodetection is
1744 * managed by enterprise policy. False otherwize.
Dan Beam 2016/04/02 01:39:14 missing @param for value
Alexander Alekseev 2016/04/05 08:03:38 Done.
1745 */
1746 setSystemTimezoneAutomaticDetectionManaged_: function(managed, value) {
1747 this.systemTimezoneAutomaticDetectionIsManaged_ = managed;
1748 this.systemTimezoneAutomaticDetectionValue_ = value;
1749 this.updateTimezoneSectionState_();
1750 },
1751
1752 /**
1710 * This is Preferences event listener, which is called when 1753 * This is Preferences event listener, which is called when
1711 * kResolveTimezoneByGeolocation preference is changed. 1754 * kResolveTimezoneByGeolocation preference is changed.
1712 * Enables or disables dependent settings. 1755 * Enables or disables dependent settings.
1713 * @param {Event} value New preference state. 1756 * @param {Event} value New preference state.
1714 */ 1757 */
1715 onResolveTimezoneByGeolocationChanged_: function(value) { 1758 onResolveTimezoneByGeolocationChanged_: function(value) {
1716 this.resolveTimezoneByGeolocation_ = value.value.value; 1759 this.resolveTimezoneByGeolocation_ = value.value.value;
1717 this.updateTimezoneSectionState_(); 1760 this.updateTimezoneSectionState_();
1718 }, 1761 },
1719 1762
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 'setNativeThemeButtonEnabled', 2291 'setNativeThemeButtonEnabled',
2249 'setNetworkPredictionValue', 2292 'setNetworkPredictionValue',
2250 'setNowSectionVisible', 2293 'setNowSectionVisible',
2251 'setHighContrastCheckboxState', 2294 'setHighContrastCheckboxState',
2252 'setAllHotwordSectionsVisible', 2295 'setAllHotwordSectionsVisible',
2253 'setMetricsReportingCheckboxState', 2296 'setMetricsReportingCheckboxState',
2254 'setMetricsReportingSettingVisibility', 2297 'setMetricsReportingSettingVisibility',
2255 'setProfilesInfo', 2298 'setProfilesInfo',
2256 'setSpokenFeedbackCheckboxState', 2299 'setSpokenFeedbackCheckboxState',
2257 'setSystemTimezoneManaged', 2300 'setSystemTimezoneManaged',
2301 'setSystemTimezoneAutomaticDetectionManaged',
2258 'setThemesResetButtonEnabled', 2302 'setThemesResetButtonEnabled',
2259 'setVirtualKeyboardCheckboxState', 2303 'setVirtualKeyboardCheckboxState',
2260 'setupPageZoomSelector', 2304 'setupPageZoomSelector',
2261 'setupProxySettingsButton', 2305 'setupProxySettingsButton',
2262 'setAudioHistorySectionVisible', 2306 'setAudioHistorySectionVisible',
2263 'showCreateProfileError', 2307 'showCreateProfileError',
2264 'showCreateProfileSuccess', 2308 'showCreateProfileSuccess',
2265 'showCreateProfileWarning', 2309 'showCreateProfileWarning',
2266 'showHotwordAlwaysOnSection', 2310 'showHotwordAlwaysOnSection',
2267 'showHotwordNoDspSection', 2311 'showHotwordNoDspSection',
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 if (section) 2378 if (section)
2335 section.hidden = true; 2379 section.hidden = true;
2336 }; 2380 };
2337 } 2381 }
2338 2382
2339 // Export 2383 // Export
2340 return { 2384 return {
2341 BrowserOptions: BrowserOptions 2385 BrowserOptions: BrowserOptions
2342 }; 2386 };
2343 }); 2387 });
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698