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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/browser_options.js
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 514c0284bc9f9760c5467a0337d7996df92d22ff..b2ee96895b39ff1eb6b237766269ed6f7012191a 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -38,6 +38,18 @@ options.ExtensionData;
*/
options.Profile;
+/**
+ * Device policy SystemTimezoneAutomaticDetection values.
+ * @enum {number}
+ * @const
+ */
+options.AutomaticTimezoneDetectionType = {
+ USERS_DECIDE: 0,
+ DISABLED: 1,
+ IP_ONLY: 2,
+ SEND_WIFI_ACCESS_POINTS: 3,
+};
+
cr.define('options', function() {
var OptionsPage = options.OptionsPage;
var Page = cr.ui.pageManager.Page;
@@ -118,6 +130,18 @@ cr.define('options', function() {
systemTimezoneIsManaged_: false,
/**
+ * True if system timezone detection is managed by policy.
+ * @private {boolean}
+ */
+ systemTimezoneAutomaticDetectionIsManaged_: false,
+
+ /**
+ * This is the value of SystemTimezoneAutomaticDetection policy.
+ * @private {number}
+ */
+ systemTimezoneAutomaticDetectionValue_: 0,
+
+ /**
* Cached bluetooth adapter state.
* @private {?chrome.bluetooth.AdapterState}
*/
@@ -1681,17 +1705,37 @@ cr.define('options', function() {
* @private
*/
updateTimezoneSectionState_: function() {
+ var self = this;
+ $('resolve-timezone-by-geolocation')
+ .onclick = function(event) {
+ self.resolveTimezoneByGeolocation_ = event.currentTarget.checked;
+ };
if (this.systemTimezoneIsManaged_) {
- $('resolve-timezone-by-geolocation-selection').disabled = true;
- $('resolve-timezone-by-geolocation').onclick = function(event) {};
+ $('resolve-timezone-by-geolocation').disabled = true;
+ $('resolve-timezone-by-geolocation').checked = false;
+ } else if (this.systemTimezoneAutomaticDetectionIsManaged_) {
+ if (this.systemTimezoneAutomaticDetectionValue_ ==
+ options.AutomaticTimezoneDetectionType.USERS_DECIDE) {
+ $('resolve-timezone-by-geolocation').disabled = false;
+ $('resolve-timezone-by-geolocation')
+ .checked = this.resolveTimezoneByGeolocation_;
+ $('timezone-value-select')
+ .disabled = this.resolveTimezoneByGeolocation_;
+ } else {
+ $('resolve-timezone-by-geolocation').disabled = true;
+ $('resolve-timezone-by-geolocation')
+ .checked =
+ (this.systemTimezoneAutomaticDetectionValue_ !=
+ options.AutomaticTimezoneDetectionType.DISABLED);
+ $('timezone-value-select').disabled = true;
+ }
} else {
this.enableElementIfPossible_(
- getRequiredElement('resolve-timezone-by-geolocation-selection'));
- $('resolve-timezone-by-geolocation').onclick = function(event) {
- $('timezone-value-select').disabled = event.currentTarget.checked;
- };
+ getRequiredElement('resolve-timezone-by-geolocation'));
$('timezone-value-select').disabled =
this.resolveTimezoneByGeolocation_;
+ $('resolve-timezone-by-geolocation')
+ .checked = this.resolveTimezoneByGeolocation_;
}
},
@@ -1707,6 +1751,20 @@ cr.define('options', function() {
},
/**
+ * This is called from chromium code when system timezone detection
+ * "managed" state is changed. Enables or disables dependent settings.
+ * @param {boolean} managed Is true when system timezone autodetection is
+ * managed by enterprise policy. False otherwize.
+ * @param {options.AutomaticTimezoneDetectionType} value Current value of
+ * SystemTimezoneAutomaticDetection device policy.
+ */
+ setSystemTimezoneAutomaticDetectionManaged_: function(managed, value) {
+ this.systemTimezoneAutomaticDetectionIsManaged_ = managed;
+ this.systemTimezoneAutomaticDetectionValue_ = value;
+ this.updateTimezoneSectionState_();
+ },
+
+ /**
* This is Preferences event listener, which is called when
* kResolveTimezoneByGeolocation preference is changed.
* Enables or disables dependent settings.
@@ -2255,6 +2313,7 @@ cr.define('options', function() {
'setProfilesInfo',
'setSpokenFeedbackCheckboxState',
'setSystemTimezoneManaged',
+ 'setSystemTimezoneAutomaticDetectionManaged',
'setThemesResetButtonEnabled',
'setVirtualKeyboardCheckboxState',
'setupPageZoomSelector',

Powered by Google App Engine
This is Rietveld 408576698