| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 observers: [ | 94 observers: [ |
| 95 'maybeGetTimeZoneList_(' + | 95 'maybeGetTimeZoneList_(' + |
| 96 'prefs.cros.system.timezone.value, timeZoneAutoDetect_)', | 96 'prefs.cros.system.timezone.value, timeZoneAutoDetect_)', |
| 97 ], | 97 ], |
| 98 | 98 |
| 99 attached: function() { | 99 attached: function() { |
| 100 this.addWebUIListener( | 100 this.addWebUIListener( |
| 101 'time-zone-auto-detect-policy', | 101 'time-zone-auto-detect-policy', |
| 102 this.onTimeZoneAutoDetectPolicyChanged_.bind(this)); | 102 this.onTimeZoneAutoDetectPolicyChanged_.bind(this)); |
| 103 this.addWebUIListener( |
| 104 'can-set-date-time-changed', this.onCanSetDateTimeChanged_.bind(this)); |
| 105 |
| 103 chrome.send('dateTimePageReady'); | 106 chrome.send('dateTimePageReady'); |
| 104 | |
| 105 this.maybeGetTimeZoneList_(); | 107 this.maybeGetTimeZoneList_(); |
| 106 }, | 108 }, |
| 107 | 109 |
| 108 /** | 110 /** |
| 109 * @param {boolean} managed Whether the auto-detect setting is controlled. | 111 * @param {boolean} managed Whether the auto-detect setting is controlled. |
| 110 * @param {boolean} valueFromPolicy The value of the auto-detect setting | 112 * @param {boolean} valueFromPolicy The value of the auto-detect setting |
| 111 * forced by policy. | 113 * forced by policy. |
| 112 * @private | 114 * @private |
| 113 */ | 115 */ |
| 114 onTimeZoneAutoDetectPolicyChanged_: function(managed, valueFromPolicy) { | 116 onTimeZoneAutoDetectPolicyChanged_: function(managed, valueFromPolicy) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 key: 'fakeTimeZonePref', | 129 key: 'fakeTimeZonePref', |
| 128 type: chrome.settingsPrivate.PrefType.NUMBER, | 130 type: chrome.settingsPrivate.PrefType.NUMBER, |
| 129 value: 0, | 131 value: 0, |
| 130 policySource: chrome.settingsPrivate.PolicySource.DEVICE_POLICY, | 132 policySource: chrome.settingsPrivate.PolicySource.DEVICE_POLICY, |
| 131 policyEnforcement: chrome.settingsPrivate.PolicyEnforcement.ENFORCED, | 133 policyEnforcement: chrome.settingsPrivate.PolicyEnforcement.ENFORCED, |
| 132 }; | 134 }; |
| 133 } | 135 } |
| 134 }, | 136 }, |
| 135 | 137 |
| 136 /** | 138 /** |
| 139 * @param {boolean} canSetDateTime Whether date and time are settable. |
| 140 * @private |
| 141 */ |
| 142 onCanSetDateTimeChanged_: function(canSetDateTime) { |
| 143 this.$.setDateTime.classList.toggle('hidden', !canSetDateTime); |
| 144 }, |
| 145 |
| 146 /** |
| 137 * @param {!Event} e | 147 * @param {!Event} e |
| 138 * @private | 148 * @private |
| 139 */ | 149 */ |
| 140 onTimeZoneAutoDetectCheckboxChange_: function(e) { | 150 onTimeZoneAutoDetectCheckboxChange_: function(e) { |
| 141 this.setPrefValue( | 151 this.setPrefValue( |
| 142 'settings.resolve_timezone_by_geolocation', e.target.checked); | 152 'settings.resolve_timezone_by_geolocation', e.target.checked); |
| 143 }, | 153 }, |
| 144 | 154 |
| 155 /** @private */ |
| 156 onSetDateTimeTap_: function() { |
| 157 chrome.send('showSetDateTimeUI'); |
| 158 }, |
| 159 |
| 145 /** | 160 /** |
| 146 * @param {settings.TimeZoneAutoDetectPolicy} timeZoneAutoDetectPolicy | 161 * @param {settings.TimeZoneAutoDetectPolicy} timeZoneAutoDetectPolicy |
| 147 * @return {boolean} | 162 * @return {boolean} |
| 148 * @private | 163 * @private |
| 149 */ | 164 */ |
| 150 computeHasTimeZoneAutoDetectPolicy_: function(timeZoneAutoDetectPolicy) { | 165 computeHasTimeZoneAutoDetectPolicy_: function(timeZoneAutoDetectPolicy) { |
| 151 return timeZoneAutoDetectPolicy != settings.TimeZoneAutoDetectPolicy.NONE; | 166 return timeZoneAutoDetectPolicy != settings.TimeZoneAutoDetectPolicy.NONE; |
| 152 }, | 167 }, |
| 153 | 168 |
| 154 /** | 169 /** |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 */ | 211 */ |
| 197 setTimeZoneList_: function(timeZones) { | 212 setTimeZoneList_: function(timeZones) { |
| 198 this.timeZoneList_ = timeZones.map(function(timeZonePair) { | 213 this.timeZoneList_ = timeZones.map(function(timeZonePair) { |
| 199 return { | 214 return { |
| 200 name: timeZonePair[1], | 215 name: timeZonePair[1], |
| 201 value: timeZonePair[0], | 216 value: timeZonePair[0], |
| 202 }; | 217 }; |
| 203 }); | 218 }); |
| 204 }, | 219 }, |
| 205 }); | 220 }); |
| OLD | NEW |