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

Side by Side Diff: chrome/browser/resources/options/chromeos/onc_data.js

Issue 552113002: Add ONC 'Source' configuration property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_9a
Patch Set: Rebase Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 ONC Data support class. Wraps a dictionary object containing 6 * @fileoverview ONC Data support class. Wraps a dictionary object containing
7 * ONC managed or unmanaged dictionaries. Supports nested dictionaries, 7 * ONC managed or unmanaged dictionaries. Supports nested dictionaries,
8 * e.g. data.getManagedProperty('VPN.Type'). 8 * e.g. data.getManagedProperty('VPN.Type').
9 */ 9 */
10 cr.define('cr.onc', function() { 10 cr.define('cr.onc', function() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return undefined; 126 return undefined;
127 if (property['UserEditable']) 127 if (property['UserEditable'])
128 return property['UserPolicy']; 128 return property['UserPolicy'];
129 if (property['DeviceEditable']) 129 if (property['DeviceEditable'])
130 return property['DevicePolicy']; 130 return property['DevicePolicy'];
131 // No value recommended by policy. 131 // No value recommended by policy.
132 return undefined; 132 return undefined;
133 }, 133 },
134 134
135 /** 135 /**
136 * Returns the Source of this configuration. If undefined return 'None'.
137 * @return {string} The configuration source: 'None', 'User' or 'Device'.
138 */
139 getSource: function() {
140 var source = this.getActiveValue('Source');
pneubeck (no reviews) 2014/09/09 19:35:32 we should ensure that the ConfigurationHandler alw
stevenjb 2014/09/10 00:00:55 That seems unnecessarily verbose to me, and would
stevenjb 2014/09/10 00:26:01 Also, in practice, any configuration that actually
pneubeck (no reviews) 2014/09/10 10:49:38 Ah, I didn't mean to remove this fallback handling
141 if (source == undefined)
142 return 'None';
143 return source;
144 },
145
146
pneubeck (no reviews) 2014/09/09 19:35:31 nit: remove empty line
stevenjb 2014/09/10 00:00:55 Done.
147 /**
148 * Returns the WiFi security type where undefined == 'None'.
pneubeck (no reviews) 2014/09/09 19:35:32 nit: " where undefined == 'None'." -> " with defau
stevenjb 2014/09/10 00:00:55 Done.
149 * @return {string} The secuirity type.
pneubeck (no reviews) 2014/09/09 19:35:32 typo: secuirity
stevenjb 2014/09/10 00:00:55 Done.
150 */
151 getWiFiSecurity: function() {
152 var security = this.getActiveValue('WiFi.Security');
153 if (security == undefined)
154 return 'None';
155 return security;
156 },
157
158 /**
136 * Updates the properties of |data_| from the properties in |update|. 159 * Updates the properties of |data_| from the properties in |update|.
137 * Note: this only looks at top level entries, so if a dictionary is 160 * Note: this only looks at top level entries, so if a dictionary is
138 * updated the entire dictionary is written over. TODO(stevenjb): 161 * updated the entire dictionary is written over. TODO(stevenjb):
139 * eliminate this function when |data_| contains only ONC entries and 162 * eliminate this function when |data_| contains only ONC entries and
140 * any updates consist of complete ONC dictionaries. 163 * any updates consist of complete ONC dictionaries.
141 * @param {Object} update Dictionary containing the updated properties. 164 * @param {Object} update Dictionary containing the updated properties.
142 */ 165 */
143 updateData: function(update) { 166 updateData: function(update) {
144 for (var prop in update) { 167 for (var prop in update) {
145 if (prop in this.data_) 168 if (prop in this.data_)
(...skipping 14 matching lines...) Expand all
160 return property[effective]; 183 return property[effective];
161 } 184 }
162 return undefined; 185 return undefined;
163 } 186 }
164 }; 187 };
165 188
166 return { 189 return {
167 OncData: OncData 190 OncData: OncData
168 }; 191 };
169 }); 192 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698