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

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

Issue 2506323002: MD Settings: show an extension-controlled-indicator for proxy (Closed)
Patch Set: Created 4 years, 1 month 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-prefs' exposes a singleton model of Chrome settings and 7 * 'settings-prefs' exposes a singleton model of Chrome settings and
8 * preferences, which listens to changes to Chrome prefs whitelisted in 8 * preferences, which listens to changes to Chrome prefs whitelisted in
9 * chrome.settingsPrivate. When changing prefs in this element's 'prefs' 9 * chrome.settingsPrivate. When changing prefs in this element's 'prefs'
10 * property via the UI, the singleton model tries to set those preferences in 10 * property via the UI, the singleton model tries to set those preferences in
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 CrSettingsPrefs.setInitialized(); 220 CrSettingsPrefs.setInitialized();
221 }, 221 },
222 222
223 /** 223 /**
224 * Checks the result of calling settingsPrivate.setPref. 224 * Checks the result of calling settingsPrivate.setPref.
225 * @param {string} key The key used in the call to setPref. 225 * @param {string} key The key used in the call to setPref.
226 * @param {boolean} success True if setting the pref succeeded. 226 * @param {boolean} success True if setting the pref succeeded.
227 * @private 227 * @private
228 */ 228 */
229 setPrefCallback_: function(key, success) { 229 setPrefCallback_: function(key, success) {
230 if (success) 230 if (!success)
231 return; 231 this.refresh(key);
232 },
232 233
233 // Get the current pref value from chrome.settingsPrivate to ensure the 234 /**
234 // UI stays up to date. 235 * Get the current pref value from chrome.settingsPrivate to ensure the UI
236 * stays up to date.
237 * @param {string} key
238 * @private
239 */
240 refresh: function(key) {
235 this.settingsApi_.getPref(key, function(pref) { 241 this.settingsApi_.getPref(key, function(pref) {
236 this.updatePrefs_([pref]); 242 this.updatePrefs_([pref]);
237 }.bind(this)); 243 }.bind(this));
238 }, 244 },
239 245
240 /** 246 /**
241 * Updates the prefs model with the given prefs. 247 * Updates the prefs model with the given prefs.
242 * @param {!Array<!chrome.settingsPrivate.PrefObject>} newPrefs 248 * @param {!Array<!chrome.settingsPrivate.PrefObject>} newPrefs
243 * @private 249 * @private
244 */ 250 */
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 this.prefs = undefined; 300 this.prefs = undefined;
295 this.lastPrefValues_ = {}; 301 this.lastPrefValues_ = {};
296 this.initialized_ = false; 302 this.initialized_ = false;
297 // Remove the listener added in initialize(). 303 // Remove the listener added in initialize().
298 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_); 304 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_);
299 this.settingsApi_ = 305 this.settingsApi_ =
300 /** @type {SettingsPrivate} */(chrome.settingsPrivate); 306 /** @type {SettingsPrivate} */(chrome.settingsPrivate);
301 }, 307 },
302 }); 308 });
303 })(); 309 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698