| Index: chrome/browser/resources/settings/date_time_page/date_time_page.js
|
| diff --git a/chrome/browser/resources/settings/date_time_page/date_time_page.js b/chrome/browser/resources/settings/date_time_page/date_time_page.js
|
| index 3b004f22eabfd72b0a33f42437fe37b9ca52e093..a6b4e2c74d39a898f3356dcac81198a68a021565 100644
|
| --- a/chrome/browser/resources/settings/date_time_page/date_time_page.js
|
| +++ b/chrome/browser/resources/settings/date_time_page/date_time_page.js
|
| @@ -91,9 +91,15 @@ Polymer({
|
|
|
| observers: [
|
| 'maybeGetTimeZoneList_(' +
|
| - 'prefs.cros.system.timezone.value, timeZoneAutoDetect_)',
|
| + 'prefs.settings.timezone.value, timeZoneAutoDetect_)',
|
| + 'onPerUserTimezoneEnabledChanged_(' +
|
| + 'prefs.cros.flags.per_user_timezone_enabled.value)',
|
| ],
|
|
|
| + // True if !prefs.cros.flags.per_user_timezone_enabled.value has been
|
| + // acknowledged.
|
| + nonPerUserTimezoneSeen_: false,
|
| +
|
| /** @override */
|
| attached: function() {
|
| this.addWebUIListener(
|
| @@ -182,10 +188,19 @@ Polymer({
|
| return;
|
|
|
| // If auto-detect is enabled, we only need the current time zone.
|
| - if (this.timeZoneAutoDetect_ &&
|
| - this.getPref('cros.system.timezone').value ==
|
| - this.timeZoneList_[0].value) {
|
| - return;
|
| + var pref = this.getPref('cros.flags.per_user_timezone_enabled');
|
| + if (pref && pref.value) {
|
| + if (this.timeZoneAutoDetect_ &&
|
| + this.getPref('settings.timezone').value ==
|
| + this.timeZoneList_[0].value) {
|
| + return;
|
| + }
|
| + } else {
|
| + if (this.timeZoneAutoDetect_ &&
|
| + this.getPref('cros.system.timezone').value ==
|
| + this.timeZoneList_[0].value) {
|
| + return;
|
| + }
|
| }
|
|
|
| cr.sendWithPromise('getTimeZones').then(this.setTimeZoneList_.bind(this));
|
| @@ -204,4 +219,36 @@ Polymer({
|
| };
|
| });
|
| },
|
| +
|
| + /**
|
| + * Computes visibility of user timezone preference.
|
| + * @param prefUserTimezone Object pref.settings.timezone
|
| + * @param prefResolveValue Boolean
|
| + * prefs.settings.resolve_timezone_by_geolocation.value
|
| + * @private
|
| + */
|
| + isUserTimeZoneSelectorHidden_: function(prefUserTimezone, prefResolveValue) {
|
| + return (prefUserTimezone && prefUserTimezone.controlledBy != null) ||
|
| + (prefResolveValue == true);
|
| + },
|
| +
|
| + /**
|
| + * Observer of this.prefs.cros.flags.per_user_timezone_enabled.value .
|
| + * If it becomes disabled, adds legacy observer.
|
| + * @private
|
| + */
|
| + onPerUserTimezoneEnabledChanged_: function() {
|
| + if (this.nonPerUserTimezoneSeen_)
|
| + return;
|
| +
|
| + var pref = this.getPref('cros.flags.per_user_timezone_enabled');
|
| + if (!pref || !pref.value) {
|
| + this.nonPerUserTimezoneSeen_ = true;
|
| + // This is polymer private API, but we could probably remove this method
|
| + // before switching to polymer 2.0 .
|
| + this.get('_addComplexObserverEffect').call(this,
|
| + 'maybeGetTimeZoneList_(' +
|
| + 'prefs.cros.system.timezone.value, timeZoneAutoDetect_)');
|
| + }
|
| + },
|
| });
|
|
|