Chromium Code Reviews| 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 2b63e80fc2d4970bc5dc83e69e9613109dd99ae9..fc24237b755bad07545d961f8620dbece1e8afe4 100644 |
| --- a/chrome/browser/resources/options/browser_options.js |
| +++ b/chrome/browser/resources/options/browser_options.js |
| @@ -118,6 +118,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 {boolean} |
| + */ |
| + systemTimezoneAutomaticDetectionValue_: 0, |
| + |
| + /** |
| * Cached bluetooth adapter state. |
| * @private {?chrome.bluetooth.AdapterState} |
| */ |
| @@ -1681,15 +1693,34 @@ 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 = null; |
|
stevenjb
2016/03/28 23:23:17
false
Alexander Alekseev
2016/03/29 00:29:26
This doesn't work. It will stay checked unless "ch
stevenjb
2016/03/29 00:39:41
That's strange, are you certain? The type of input
Alexander Alekseev
2016/03/29 03:59:24
" the presence of this Boolean attribute indicates
|
| + } else if (this.systemTimezoneAutomaticDetectionIsManaged_) { |
| + if (this.systemTimezoneAutomaticDetectionValue_ == |
| + 0 /* USERS_DECIDE */) { |
| + $('resolve-timezone-by-geolocation').disabled = false; |
| + $('resolve-timezone-by-geolocation') |
| + .checked = this.resolveTimezoneByGeolocation_ ? true : null; |
|
stevenjb
2016/03/28 23:23:17
true : false ?
Alexander Alekseev
2016/03/29 00:29:26
null is required.
|
| + $('timezone-value-select') |
| + .disabled = this.resolveTimezoneByGeolocation_; |
| + } else { |
| + $('resolve-timezone-by-geolocation').disabled = true; |
| + $('resolve-timezone-by-geolocation') |
| + .checked = (this.systemTimezoneAutomaticDetectionValue_ != |
| + 1 /* DISABLED */) ? |
| + true : |
| + null; |
|
stevenjb
2016/03/28 23:23:18
Shouldn't this just be (this.systemTimezoneAutomat
Alexander Alekseev
2016/03/29 00:29:25
Null is required here.
|
| + $('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_; |
| } |
| @@ -1707,6 +1738,18 @@ 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. |
| + */ |
| + 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 +2298,7 @@ cr.define('options', function() { |
| 'setProfilesInfo', |
| 'setSpokenFeedbackCheckboxState', |
| 'setSystemTimezoneManaged', |
| + 'setSystemTimezoneAutomaticDetectionManaged', |
| 'setThemesResetButtonEnabled', |
| 'setVirtualKeyboardCheckboxState', |
| 'setupPageZoomSelector', |