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

Side by Side Diff: chrome/browser/resources/settings/date_time_page/date_time_page.js

Issue 2744923002: cr-policy-indicator element for non-preference-based indicators (Closed)
Patch Set: alphabetize Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 * @private 56 * @private
57 */ 57 */
58 timeZoneAutoDetect_: { 58 timeZoneAutoDetect_: {
59 type: Boolean, 59 type: Boolean,
60 computed: 'computeTimeZoneAutoDetect_(' + 60 computed: 'computeTimeZoneAutoDetect_(' +
61 'timeZoneAutoDetectPolicy_,' + 61 'timeZoneAutoDetectPolicy_,' +
62 'prefs.settings.resolve_timezone_by_geolocation.value)', 62 'prefs.settings.resolve_timezone_by_geolocation.value)',
63 }, 63 },
64 64
65 /** 65 /**
66 * A fake preference to provide cr-policy-pref-indicator with policy info.
67 * @private {!chrome.settingsPrivate.PrefObject|undefined}
68 */
69 fakeTimeZonePolicyPref_: Object,
70
71 /**
72 * Initialized with the current time zone so the menu displays the 66 * Initialized with the current time zone so the menu displays the
73 * correct value. The full option list is fetched lazily if necessary by 67 * correct value. The full option list is fetched lazily if necessary by
74 * maybeGetTimeZoneList_. 68 * maybeGetTimeZoneList_.
75 * @private {!DropdownMenuOptionList} 69 * @private {!DropdownMenuOptionList}
76 */ 70 */
77 timeZoneList_: { 71 timeZoneList_: {
78 type: Array, 72 type: Array,
79 value: function() { 73 value: function() {
80 return [{ 74 return [{
81 name: loadTimeData.getString('timeZoneName'), 75 name: loadTimeData.getString('timeZoneName'),
(...skipping 29 matching lines...) Expand all
111 this.maybeGetTimeZoneList_(); 105 this.maybeGetTimeZoneList_();
112 }, 106 },
113 107
114 /** 108 /**
115 * @param {boolean} managed Whether the auto-detect setting is controlled. 109 * @param {boolean} managed Whether the auto-detect setting is controlled.
116 * @param {boolean} valueFromPolicy The value of the auto-detect setting 110 * @param {boolean} valueFromPolicy The value of the auto-detect setting
117 * forced by policy. 111 * forced by policy.
118 * @private 112 * @private
119 */ 113 */
120 onTimeZoneAutoDetectPolicyChanged_: function(managed, valueFromPolicy) { 114 onTimeZoneAutoDetectPolicyChanged_: function(managed, valueFromPolicy) {
121 if (!managed) { 115 if (managed) {
116 this.timeZoneAutoDetectPolicy_ = valueFromPolicy ?
117 settings.TimeZoneAutoDetectPolicy.FORCED_ON :
118 settings.TimeZoneAutoDetectPolicy.FORCED_OFF;
119 } else {
122 this.timeZoneAutoDetectPolicy_ = settings.TimeZoneAutoDetectPolicy.NONE; 120 this.timeZoneAutoDetectPolicy_ = settings.TimeZoneAutoDetectPolicy.NONE;
123 this.fakeTimeZonePolicyPref_ = undefined;
124 return;
125 }
126
127 this.timeZoneAutoDetectPolicy_ = valueFromPolicy ?
128 settings.TimeZoneAutoDetectPolicy.FORCED_ON :
129 settings.TimeZoneAutoDetectPolicy.FORCED_OFF;
130
131 if (!this.fakeTimeZonePolicyPref_) {
132 this.fakeTimeZonePolicyPref_ = {
133 key: 'fakeTimeZonePref',
134 type: chrome.settingsPrivate.PrefType.NUMBER,
135 value: 0,
136 controlledBy: chrome.settingsPrivate.ControlledBy.DEVICE_POLICY,
137 enforcement: chrome.settingsPrivate.Enforcement.ENFORCED,
138 };
139 } 121 }
140 }, 122 },
141 123
142 /** 124 /**
143 * @param {boolean} canSetDateTime Whether date and time are settable. 125 * @param {boolean} canSetDateTime Whether date and time are settable.
144 * @private 126 * @private
145 */ 127 */
146 onCanSetDateTimeChanged_: function(canSetDateTime) { 128 onCanSetDateTimeChanged_: function(canSetDateTime) {
147 this.canSetDateTime_ = canSetDateTime; 129 this.canSetDateTime_ = canSetDateTime;
148 }, 130 },
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 */ 197 */
216 setTimeZoneList_: function(timeZones) { 198 setTimeZoneList_: function(timeZones) {
217 this.timeZoneList_ = timeZones.map(function(timeZonePair) { 199 this.timeZoneList_ = timeZones.map(function(timeZonePair) {
218 return { 200 return {
219 name: timeZonePair[1], 201 name: timeZonePair[1],
220 value: timeZonePair[0], 202 value: timeZonePair[0],
221 }; 203 };
222 }); 204 });
223 }, 205 },
224 }); 206 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698