| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-date-time-page' is the settings page containing date and time | 7 * 'settings-date-time-page' is the settings page containing date and time |
| 8 * settings. | 8 * settings. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 */ | 67 */ |
| 68 systemTimeZoneDetectionPolicyValue_: { | 68 systemTimeZoneDetectionPolicyValue_: { |
| 69 type: Number, | 69 type: Number, |
| 70 value: function() { | 70 value: function() { |
| 71 return loadTimeData.valueExists('systemTimeZoneDetectionPolicyValue') ? | 71 return loadTimeData.valueExists('systemTimeZoneDetectionPolicyValue') ? |
| 72 /** @type {settings.AutomaticTimezoneDetectionPolicy} */( | 72 /** @type {settings.AutomaticTimezoneDetectionPolicy} */( |
| 73 loadTimeData.getInteger('systemTimeZoneDetectionPolicyValue')) : | 73 loadTimeData.getInteger('systemTimeZoneDetectionPolicyValue')) : |
| 74 null; | 74 null; |
| 75 }, | 75 }, |
| 76 }, | 76 }, |
| 77 | |
| 78 /** | |
| 79 * Hides the time zone auto-detection feature when the | |
| 80 * --disable-timezone-tracking-option flag is set. | |
| 81 * @private | |
| 82 */ | |
| 83 hideTimeZoneDetection_: { | |
| 84 type: Boolean, | |
| 85 value: function() { | |
| 86 return loadTimeData.valueExists('hideTimeZoneDetection') && | |
| 87 loadTimeData.getBoolean('hideTimeZoneDetection'); | |
| 88 }, | |
| 89 readOnly: true, | |
| 90 }, | |
| 91 }, | 77 }, |
| 92 | 78 |
| 93 observers: [ | 79 observers: [ |
| 94 // TODO(michaelpg): Implement a BrowserProxy to listen for policy changes. | 80 // TODO(michaelpg): Implement a BrowserProxy to listen for policy changes. |
| 95 'updateTimeZoneDetectionCheckbox_(' + | 81 'updateTimeZoneDetectionCheckbox_(' + |
| 96 'prefs.settings.resolve_timezone_by_geolocation.value,' + | 82 'prefs.settings.resolve_timezone_by_geolocation.value,' + |
| 97 'systemTimeZoneManaged_,' + | 83 'systemTimeZoneManaged_,' + |
| 98 'systemTimeZoneDetectionManaged_,' + | 84 'systemTimeZoneDetectionManaged_,' + |
| 99 'systemTimeZoneDetectionPolicyValue_)', | 85 'systemTimeZoneDetectionPolicyValue_)', |
| 100 ], | 86 ], |
| 101 | 87 |
| 102 /** | 88 /** |
| 103 * Processes all the time zone preferences and policy interactions in one | 89 * Processes all the time zone preferences and policy interactions in one |
| 104 * observer function instead of complicating the HTML with computed bindings. | 90 * observer function instead of complicating the HTML with computed bindings. |
| 105 * @param {boolean} userPrefValue | 91 * @param {boolean} userPrefValue |
| 106 * @param {boolean} systemTimeZoneManaged | 92 * @param {boolean} systemTimeZoneManaged |
| 107 * @param {boolean} systemTimeZoneDetectionManaged | 93 * @param {boolean} systemTimeZoneDetectionManaged |
| 108 * @param {?settings.AutomaticTimezoneDetectionPolicy} | 94 * @param {?settings.AutomaticTimezoneDetectionPolicy} |
| 109 * systemTimeZoneDetectionPolicyValue | 95 * systemTimeZoneDetectionPolicyValue |
| 110 */ | 96 */ |
| 111 updateTimeZoneDetectionCheckbox_(userPrefValue, | 97 updateTimeZoneDetectionCheckbox_(userPrefValue, |
| 112 systemTimeZoneManaged, | 98 systemTimeZoneManaged, |
| 113 systemTimeZoneDetectionManaged, | 99 systemTimeZoneDetectionManaged, |
| 114 systemTimeZoneDetectionPolicyValue) { | 100 systemTimeZoneDetectionPolicyValue) { |
| 115 // Do nothing if the feature is disabled by a flag. | |
| 116 if (this.hideTimeZoneDetection_) | |
| 117 return; | |
| 118 | |
| 119 var checkbox = this.$.timeZoneDetectionCheckbox; | 101 var checkbox = this.$.timeZoneDetectionCheckbox; |
| 120 | 102 |
| 121 // Time zone auto-detection is disabled when the time zone is managed. | 103 // Time zone auto-detection is disabled when the time zone is managed. |
| 122 if (systemTimeZoneManaged) { | 104 if (systemTimeZoneManaged) { |
| 123 checkbox.disabled = true; | 105 checkbox.disabled = true; |
| 124 checkbox.checked = false; | 106 checkbox.checked = false; |
| 125 return; | 107 return; |
| 126 } | 108 } |
| 127 | 109 |
| 128 // The time zone auto-detection policy may force-disable auto-detection. | 110 // The time zone auto-detection policy may force-disable auto-detection. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 checkbox.disabled = false; | 122 checkbox.disabled = false; |
| 141 checkbox.checked = userPrefValue; | 123 checkbox.checked = userPrefValue; |
| 142 }, | 124 }, |
| 143 | 125 |
| 144 /** @param {!Event} e */ | 126 /** @param {!Event} e */ |
| 145 onTimeZoneDetectionCheckboxChange_: function(e) { | 127 onTimeZoneDetectionCheckboxChange_: function(e) { |
| 146 this.setPrefValue( | 128 this.setPrefValue( |
| 147 'settings.resolve_timezone_by_geolocation', e.target.checked); | 129 'settings.resolve_timezone_by_geolocation', e.target.checked); |
| 148 }, | 130 }, |
| 149 }); | 131 }); |
| OLD | NEW |