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 * 'cr-settings-prefs' is an element which serves as a model for | 7 * 'cr-settings-prefs' is an element which serves as a model for |
8 * interaction with settings which are stored in Chrome's | 8 * interaction with settings which are stored in Chrome's |
9 * Preferences. | 9 * Preferences. |
10 * | 10 * |
11 * Example: | 11 * Example: |
12 * | 12 * |
13 * <cr-settings-prefs id="prefs"></cr-settings-prefs> | 13 * <cr-settings-prefs id="prefs"></cr-settings-prefs> |
14 * <cr-settings-a11y-page prefs="{{this.$.prefs}}"></cr-settings-a11y-page> | 14 * <cr-settings-a11y-page prefs="{{this.$.prefs}}"></cr-settings-a11y-page> |
15 * | 15 * |
16 * @group Chrome Settings Elements | 16 * @group Chrome Settings Elements |
17 * @element cr-settings-a11y-page | 17 * @element cr-settings-a11y-page |
18 */ | 18 */ |
19 (function() { | 19 (function() { |
20 'use strict'; | 20 'use strict'; |
21 | 21 |
22 Polymer('cr-settings-prefs', { | 22 Polymer({ |
23 publish: { | 23 is: 'cr-settings-prefs', |
| 24 |
| 25 properties: { |
24 /** | 26 /** |
25 * Object containing all preferences. | 27 * Object containing all preferences. |
26 * | |
27 * @attribute settings | |
28 * @type {Object} | |
29 * @default null | |
30 */ | 28 */ |
31 settings: null, | 29 settings: { |
| 30 type: Object, |
| 31 value: function() { return {}; }, |
| 32 notify: true, |
| 33 }, |
32 }, | 34 }, |
33 | 35 |
34 /** @override */ | 36 /** @override */ |
35 created: function() { | 37 created: function() { |
36 CrSettingsPrefs.isInitialized = false; | 38 CrSettingsPrefs.isInitialized = false; |
37 this.settings = {}; | |
38 | 39 |
39 chrome.settingsPrivate.onPrefsChanged.addListener( | 40 chrome.settingsPrivate.onPrefsChanged.addListener( |
40 this.onPrefsChanged_.bind(this)); | 41 this.onPrefsChanged_.bind(this)); |
41 chrome.settingsPrivate.getAllPrefs(this.onPrefsFetched_.bind(this)); | 42 chrome.settingsPrivate.getAllPrefs(this.onPrefsFetched_.bind(this)); |
42 }, | 43 }, |
43 | 44 |
44 /** | 45 /** |
45 * Called when prefs in the underlying Chrome pref store are changed. | 46 * Called when prefs in the underlying Chrome pref store are changed. |
46 * @param {!Array<!chrome.settingsPrivate.PrefObject>} prefs The prefs that | 47 * @param {!Array<!chrome.settingsPrivate.PrefObject>} prefs The prefs that |
47 * changed. | 48 * changed. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 chrome.settingsPrivate.setPref( | 126 chrome.settingsPrivate.setPref( |
126 propertyPath, | 127 propertyPath, |
127 newValue, | 128 newValue, |
128 /* pageId */ '', | 129 /* pageId */ '', |
129 /* callback */ function() {}); | 130 /* callback */ function() {}); |
130 } | 131 } |
131 }, | 132 }, |
132 }); | 133 }); |
133 })(); | 134 })(); |
OLD | NEW |