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 * |
(...skipping 21 matching lines...) Expand all Loading... |
32 ]; | 32 ]; |
33 | 33 |
34 /** | 34 /** |
35 * A list of all CrOS-only pref paths used in the UI. | 35 * A list of all CrOS-only pref paths used in the UI. |
36 * TODO(jlklein): This is a temporary workaround that needs to be removed | 36 * TODO(jlklein): This is a temporary workaround that needs to be removed |
37 * once settingsPrivate is implemented with the fetchAll function. We will | 37 * once settingsPrivate is implemented with the fetchAll function. We will |
38 * not need to tell the settingsPrivate API which prefs to fetch. | 38 * not need to tell the settingsPrivate API which prefs to fetch. |
39 * @const {!Array<string>} | 39 * @const {!Array<string>} |
40 */ | 40 */ |
41 var CROS_ONLY_PREFS = [ | 41 var CROS_ONLY_PREFS = [ |
| 42 'cros.system.timezone', |
42 'settings.accessibility', | 43 'settings.accessibility', |
43 'settings.a11y.autoclick', | 44 'settings.a11y.autoclick', |
44 'settings.a11y.autoclick_delay_ms', | 45 'settings.a11y.autoclick_delay_ms', |
45 'settings.a11y.enable_menu', | 46 'settings.a11y.enable_menu', |
46 'settings.a11y.high_contrast_enabled', | 47 'settings.a11y.high_contrast_enabled', |
47 'settings.a11y.large_cursor_enabled', | 48 'settings.a11y.large_cursor_enabled', |
48 'settings.a11y.screen_magnifier', | 49 'settings.a11y.screen_magnifier', |
49 'settings.a11y.sticky_keys_enabled', | 50 'settings.a11y.sticky_keys_enabled', |
50 'settings.a11y.virtual_keyboard', | 51 'settings.a11y.virtual_keyboard', |
| 52 'settings.clock.use_24hour_clock', |
51 'settings.touchpad.enable_tap_dragging', | 53 'settings.touchpad.enable_tap_dragging', |
52 ]; | 54 ]; |
53 | 55 |
54 Polymer('cr-settings-prefs', { | 56 Polymer('cr-settings-prefs', { |
55 publish: { | 57 publish: { |
56 /** | 58 /** |
57 * Object containing all preferences. | 59 * Object containing all preferences. |
58 * | 60 * |
59 * @attribute settings | 61 * @attribute settings |
60 * @type {Object} | 62 * @type {Object} |
(...skipping 15 matching lines...) Expand all Loading... |
76 * @private | 78 * @private |
77 */ | 79 */ |
78 fetchSettings_: function() { | 80 fetchSettings_: function() { |
79 // *Sigh* We need to export the function name to global scope. This is | 81 // *Sigh* We need to export the function name to global scope. This is |
80 // needed the CoreOptionsHandler can only call a function in the global | 82 // needed the CoreOptionsHandler can only call a function in the global |
81 // scope. | 83 // scope. |
82 var callbackName = 'CrSettingsPrefs_onPrefsFetched'; | 84 var callbackName = 'CrSettingsPrefs_onPrefsFetched'; |
83 window[callbackName] = this.onPrefsFetched_.bind(this); | 85 window[callbackName] = this.onPrefsFetched_.bind(this); |
84 var prefsToFetch = PREFS_TO_FETCH; | 86 var prefsToFetch = PREFS_TO_FETCH; |
85 if (cr.isChromeOS) | 87 if (cr.isChromeOS) |
86 prefsToFetch.concat(CROS_ONLY_PREFS); | 88 prefsToFetch = prefsToFetch.concat(CROS_ONLY_PREFS); |
87 | 89 |
88 chrome.send('fetchPrefs', [callbackName].concat(prefsToFetch)); | 90 chrome.send('fetchPrefs', [callbackName].concat(prefsToFetch)); |
89 }, | 91 }, |
90 | 92 |
91 /** | 93 /** |
92 * Fetches all settings from settingsPrivate. | 94 * Fetches all settings from settingsPrivate. |
93 * @param {!Object} dict Map of fetched property values. | 95 * @param {!Object} dict Map of fetched property values. |
94 * @private | 96 * @private |
95 */ | 97 */ |
96 onPrefsFetched_: function(dict) { | 98 onPrefsFetched_: function(dict) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 /** | 217 /** |
216 * @param {string} propertyPath The full path of the pref. | 218 * @param {string} propertyPath The full path of the pref. |
217 * @param {!Array} value The new value of the pref. | 219 * @param {!Array} value The new value of the pref. |
218 * @private | 220 * @private |
219 */ | 221 */ |
220 setArrayPref_: function(propertyPath, value) { | 222 setArrayPref_: function(propertyPath, value) { |
221 chrome.send('setListPref', [propertyPath, value]); | 223 chrome.send('setListPref', [propertyPath, value]); |
222 }, | 224 }, |
223 }); | 225 }); |
224 })(); | 226 })(); |
OLD | NEW |