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

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

Issue 1310373008: Add cr_policy_indicator for settings controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_settings_compiled_resources_3
Patch Set: Rebase + Feedback Created 5 years, 3 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 * 'cr-settings-prefs' models Chrome settings and preferences, listening for 7 * 'cr-settings-prefs' models Chrome settings and preferences, listening for
8 * changes to Chrome prefs whitelisted in chrome.settingsPrivate. 8 * changes to Chrome prefs whitelisted in chrome.settingsPrivate.
9 * When changing prefs in this element's 'prefs' property via the UI, this 9 * When changing prefs in this element's 'prefs' property via the UI, this
10 * element tries to set those preferences in Chrome. Whether or not the calls to 10 * element tries to set those preferences in Chrome. Whether or not the calls to
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 }, 229 },
230 230
231 /** 231 /**
232 * Sets or updates the pref denoted by newPrefObj.key in the publicy exposed 232 * Sets or updates the pref denoted by newPrefObj.key in the publicy exposed
233 * |prefs| property. 233 * |prefs| property.
234 * @param {chrome.settingsPrivate.PrefObject} newPrefObj The pref object to 234 * @param {chrome.settingsPrivate.PrefObject} newPrefObj The pref object to
235 * update the pref with. 235 * update the pref with.
236 * @private 236 * @private
237 */ 237 */
238 setPref_: function(newPrefObj) { 238 setPref_: function(newPrefObj) {
239 // Check if the pref exists already in the Polymer |prefs| object. 239 // Add the pref object to |prefs| if necessary and set it. Note: we need
240 if (this.get(newPrefObj.key, this.prefs)) { 240 // to always set the entire object, not just the value, in case any policy
241 // Update just the value, notifying listeners of the change. 241 // or other attributes change.
242 this.set('prefs.' + newPrefObj.key + '.value', newPrefObj.value); 242 cr.exportPath(newPrefObj.key, newPrefObj, this.prefs);
243 } else { 243 // Notify listeners of the change at the preference key.
244 // Add the pref to |prefs|. cr.exportPath doesn't use Polymer.Base.set, 244 this.notifyPath('prefs.' + newPrefObj.key, newPrefObj);
michaelpg 2015/09/16 18:58:52 You'll need to rebase this on https://codereview.c
stevenjb 2015/09/16 21:33:53 Acknowledged.
245 // which is OK because the nested property update events aren't useful.
246 cr.exportPath(newPrefObj.key, newPrefObj, this.prefs);
247 // Notify listeners of the change at the preference key.
248 this.notifyPath('prefs.' + newPrefObj.key, newPrefObj);
249 }
250 }, 245 },
251 246
252 /** 247 /**
253 * Creates a PrefWrapper object from a chrome.settingsPrivate pref. 248 * Creates a PrefWrapper object from a chrome.settingsPrivate pref.
254 * @param {!chrome.settingsPrivate.PrefObject} prefObj 249 * @param {!chrome.settingsPrivate.PrefObject} prefObj
255 * PrefObject received from chrome.settingsPrivate. 250 * PrefObject received from chrome.settingsPrivate.
256 * @return {PrefWrapper} An object containing a copy of the PrefObject's 251 * @return {PrefWrapper} An object containing a copy of the PrefObject's
257 * value. 252 * value.
258 * @private 253 * @private
259 */ 254 */
260 createPrefWrapper_: function(prefObj) { 255 createPrefWrapper_: function(prefObj) {
261 return prefObj.type == chrome.settingsPrivate.PrefType.LIST ? 256 return prefObj.type == chrome.settingsPrivate.PrefType.LIST ?
262 new ListPrefWrapper(prefObj) : new PrefWrapper(prefObj); 257 new ListPrefWrapper(prefObj) : new PrefWrapper(prefObj);
263 }, 258 },
264 }); 259 });
265 })(); 260 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698