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

Side by Side Diff: ui/webui/resources/cr_elements/network/cr_onc_types.js

Issue 2311473002: MD Settings: Third party VPN support (Closed)
Patch Set: . Created 4 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
« no previous file with comments | « ui/webui/resources/cr_elements/network/cr_network_list_item.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 This file has two parts: 6 * @fileoverview This file has two parts:
7 * 7 *
8 * 1. Typedefs for network properties. Note: These 'types' define a subset of 8 * 1. Typedefs for network properties. Note: These 'types' define a subset of
9 * ONC properties in the ONC data dictionary. The first letter is capitalized to 9 * ONC properties in the ONC data dictionary. The first letter is capitalized to
10 * match the ONC spec and avoid an extra layer of translation. 10 * match the ONC spec and avoid an extra layer of translation.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 * @return {boolean} The AutoConnect value if it exists or false. 307 * @return {boolean} The AutoConnect value if it exists or false.
308 */ 308 */
309 CrOnc.getAutoConnect = function(properties) { 309 CrOnc.getAutoConnect = function(properties) {
310 var autoconnect = CrOnc.getManagedAutoConnect(properties); 310 var autoconnect = CrOnc.getManagedAutoConnect(properties);
311 return !!CrOnc.getActiveValue(autoconnect); 311 return !!CrOnc.getActiveValue(autoconnect);
312 }; 312 };
313 313
314 /** 314 /**
315 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined} 315 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined}
316 * properties The ONC network properties or state properties. 316 * properties The ONC network properties or state properties.
317 * @param {!Object} caller The caller, passed as 'this' to i18.
michaelpg 2016/09/06 21:22:08 i18n
michaelpg 2016/09/06 21:22:09 nit: this is normally called "context", as it's th
stevenjb 2016/09/12 23:12:27 Done.
stevenjb 2016/09/12 23:12:27 Done.
317 * @param {!Object<function(string, ...string):string>} i18n 318 * @param {!Object<function(string, ...string):string>} i18n
318 * @return {string} The name to display for |network|. 319 * @return {string} The name to display for |network|.
319 */ 320 */
320 CrOnc.getNetworkName = function(properties, i18n) { 321 CrOnc.getNetworkName = function(properties, caller, i18n) {
321 if (!properties) 322 if (!properties)
322 return ''; 323 return '';
323 let name = CrOnc.getStateOrActiveString(properties.Name); 324 let name = CrOnc.getStateOrActiveString(properties.Name);
324 let type = CrOnc.getStateOrActiveString(properties.Type); 325 let type = CrOnc.getStateOrActiveString(properties.Type);
325 if (!name) 326 if (!name)
326 return i18n.call('OncType' + type); 327 return i18n.call(caller, 'OncType' + type);
michaelpg 2016/09/06 21:22:08 actually, this function would be simpler if you si
stevenjb 2016/09/12 23:12:27 OK, after a bit of wrangling I was able to define
327 if (type == 'VPN' && properties.VPN) { 328 if (type == 'VPN' && properties.VPN) {
328 let vpnType = CrOnc.getStateOrActiveString(properties.VPN.Type); 329 let vpnType = CrOnc.getStateOrActiveString(properties.VPN.Type);
329 if (vpnType == 'ThirdPartyVPN' && properties.VPN.ThirdPartyVPN) { 330 if (vpnType == 'ThirdPartyVPN' && properties.VPN.ThirdPartyVPN) {
330 let providerName = properties.VPN.ThirdPartyVPN.ProviderName; 331 let providerName = properties.VPN.ThirdPartyVPN.ProviderName;
331 if (providerName) 332 if (providerName)
332 return i18n.call('vpnNameTemplate', providerName, name); 333 return i18n.call(caller, 'vpnNameTemplate', providerName, name);
333 } 334 }
334 } 335 }
335 return name; 336 return name;
336 }; 337 };
337 338
338 /** 339 /**
339 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined} 340 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined}
340 * properties The ONC network properties or state properties. 341 * properties The ONC network properties or state properties.
341 * @return {boolean} True if |properties| is a Cellular network with a 342 * @return {boolean} True if |properties| is a Cellular network with a
342 * locked SIM. 343 * locked SIM.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 prefixLength += 1; 501 prefixLength += 1;
501 } else if (token == '0') { 502 } else if (token == '0') {
502 prefixLength += 0; 503 prefixLength += 0;
503 } else { 504 } else {
504 // mask is not a valid number. 505 // mask is not a valid number.
505 return -1; 506 return -1;
506 } 507 }
507 } 508 }
508 return prefixLength; 509 return prefixLength;
509 }; 510 };
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/network/cr_network_list_item.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698