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

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

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh Created 5 years, 6 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' 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 let root = this.prefStore; 77 let root = this.prefStore;
78 let tokens = prefObj.key.split('.'); 78 let tokens = prefObj.key.split('.');
79 79
80 assert(tokens.length > 0); 80 assert(tokens.length > 0);
81 81
82 for (let i = 0; i < tokens.length; i++) { 82 for (let i = 0; i < tokens.length; i++) {
83 let token = tokens[i]; 83 let token = tokens[i];
84 84
85 if (!root.hasOwnProperty(token)) { 85 if (!root.hasOwnProperty(token)) {
86 let path = 'prefStore.' + tokens.slice(0, i + 1).join('.'); 86 let path = 'prefStore.' + tokens.slice(0, i + 1).join('.');
87 this.setPathValue(path, {}); 87 this.set(path, {});
88 } 88 }
89 root = root[token]; 89 root = root[token];
90 } 90 }
91 91
92 // NOTE: Do this copy rather than just a re-assignment, so that the 92 // NOTE: Do this copy rather than just a re-assignment, so that the
93 // observer fires. 93 // observer fires.
94 for (let objKey in prefObj) { 94 for (let objKey in prefObj) {
95 let path = 'prefStore.' + prefObj.key + '.' + objKey; 95 let path = 'prefStore.' + prefObj.key + '.' + objKey;
96 this.setPathValue(path, prefObj[objKey]); 96 this.set(path, prefObj[objKey]);
97 } 97 }
98 98
99 if (shouldObserve) { 99 if (shouldObserve) {
100 Object.observe(root, this.propertyChangeCallback_, ['update']); 100 Object.observe(root, this.propertyChangeCallback_, ['update']);
101 } 101 }
102 }, this); 102 }, this);
103 }, 103 },
104 104
105 /** 105 /**
106 * Called when a property of a pref changes. 106 * Called when a property of a pref changes.
(...skipping 12 matching lines...) Expand all
119 119
120 chrome.settingsPrivate.setPref( 120 chrome.settingsPrivate.setPref(
121 change.object['key'], 121 change.object['key'],
122 newValue, 122 newValue,
123 /* pageId */ '', 123 /* pageId */ '',
124 /* callback */ function() {}); 124 /* callback */ function() {});
125 }); 125 });
126 }, 126 },
127 }); 127 });
128 })(); 128 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698