| 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-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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * Used to initialize the singleton with a fake SettingsPrivate. | 233 * Used to initialize the singleton with a fake SettingsPrivate. |
| 234 * @param {SettingsPrivate} settingsApi Fake implementation to use. | 234 * @param {SettingsPrivate} settingsApi Fake implementation to use. |
| 235 */ | 235 */ |
| 236 initializeForTesting: function(settingsApi) { | 236 initializeForTesting: function(settingsApi) { |
| 237 this.singleton_.initialize(settingsApi); | 237 this.singleton_.initialize(settingsApi); |
| 238 }, | 238 }, |
| 239 | 239 |
| 240 /** | 240 /** |
| 241 * Uninitializes this element to remove it from tests. Also resets | 241 * Uninitializes this element to render it inert in tests. Also resets |
| 242 * settings-prefs-singleton, allowing newly created elements to | 242 * settings-prefs-singleton, allowing newly created elements to |
| 243 * re-initialize it. | 243 * re-initialize it. |
| 244 */ | 244 */ |
| 245 resetForTesting: function() { | 245 uninitializeForTesting: function() { |
| 246 this.stopListening_(); |
| 246 this.singleton_.resetForTesting(); | 247 this.singleton_.resetForTesting(); |
| 247 }, | 248 }, |
| 248 }); | 249 }); |
| 249 | 250 |
| 250 /** | 251 /** |
| 251 * Privately used element that contains, listens to and updates the shared | 252 * Privately used element that contains, listens to and updates the shared |
| 252 * prefs state. | 253 * prefs state. |
| 253 */ | 254 */ |
| 254 Polymer({ | 255 Polymer({ |
| 255 is: 'settings-prefs-singleton', | 256 is: 'settings-prefs-singleton', |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 this.prefs = undefined; | 432 this.prefs = undefined; |
| 432 this.lastPrefValues_ = {}; | 433 this.lastPrefValues_ = {}; |
| 433 this.initialized_ = false; | 434 this.initialized_ = false; |
| 434 // Remove the listener added in initialize(). | 435 // Remove the listener added in initialize(). |
| 435 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_); | 436 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_); |
| 436 this.settingsApi_ = | 437 this.settingsApi_ = |
| 437 /** @type {SettingsPrivate} */(chrome.settingsPrivate); | 438 /** @type {SettingsPrivate} */(chrome.settingsPrivate); |
| 438 }, | 439 }, |
| 439 }); | 440 }); |
| 440 })(); | 441 })(); |
| OLD | NEW |