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

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

Issue 1138013005: Lots of small fixes to help wire things together for the 0.8 upgrade. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lots of small fixes to help wire things together for the 0.8 upgrade. Created 5 years, 7 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 prefs.forEach(function(prefObj) { 76 prefs.forEach(function(prefObj) {
77 let root = this.settings; 77 let root = this.settings;
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 root[token] = {}; 86 let path = 'settings.' + tokens.slice(0, i + 1).join('.');
87 this.setPathValue(path, {});
87 } 88 }
88 root = root[token]; 89 root = root[token];
89 } 90 }
90 91
91 // 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
92 // ObjectObserver fires. 93 // ObjectObserver fires.
michaelpg 2015/05/13 19:38:30 is this logic still valid, or can we just use this
Jeremy Klein 2015/05/13 21:13:56 Hard to say for sure until all this binding logic
93 for (let objKey in prefObj) { 94 for (let objKey in prefObj) {
94 root[objKey] = prefObj[objKey]; 95 let path = 'settings.' + prefObj.key + '.' + objKey;
96 this.setPathValue(path, prefObj[objKey]);
95 } 97 }
96 98
97 if (shouldObserve) { 99 if (shouldObserve) {
98 let keyObserver = new ObjectObserver(root); 100 let keyObserver = new ObjectObserver(root);
99 keyObserver.open( 101 keyObserver.open(
100 this.propertyChangeCallback_.bind(this, prefObj.key)); 102 this.propertyChangeCallback_.bind(this, prefObj.key));
101 } 103 }
102 }, this); 104 }, this);
103 }, 105 },
104 106
(...skipping 20 matching lines...) Expand all
125 127
126 chrome.settingsPrivate.setPref( 128 chrome.settingsPrivate.setPref(
127 propertyPath, 129 propertyPath,
128 newValue, 130 newValue,
129 /* pageId */ '', 131 /* pageId */ '',
130 /* callback */ function() {}); 132 /* callback */ function() {});
131 } 133 }
132 }, 134 },
133 }); 135 });
134 })(); 136 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698