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

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: Rebase 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
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<function(string, ...string):string>} i18n 317 * @param {!I18nBehavior.Proto} i18nBehavior An I18nBehavior instance.
318 * @return {string} The name to display for |network|. 318 * @return {string} The name to display for |network|.
319 */ 319 */
320 CrOnc.getNetworkName = function(properties, i18n) { 320 CrOnc.getNetworkName = function(properties, i18nBehavior) {
321 if (!properties) 321 if (!properties)
322 return ''; 322 return '';
323 let name = CrOnc.getStateOrActiveString(properties.Name); 323 let name = CrOnc.getStateOrActiveString(properties.Name);
324 let type = CrOnc.getStateOrActiveString(properties.Type); 324 let type = CrOnc.getStateOrActiveString(properties.Type);
325 if (!name) 325 if (!name)
326 return i18n.call('OncType' + type); 326 return i18nBehavior.i18n('OncType' + type);
327 if (type == 'VPN' && properties.VPN) { 327 if (type == 'VPN' && properties.VPN) {
328 let vpnType = CrOnc.getStateOrActiveString(properties.VPN.Type); 328 let vpnType = CrOnc.getStateOrActiveString(properties.VPN.Type);
329 if (vpnType == 'ThirdPartyVPN' && properties.VPN.ThirdPartyVPN) { 329 if (vpnType == 'ThirdPartyVPN' && properties.VPN.ThirdPartyVPN) {
330 let providerName = properties.VPN.ThirdPartyVPN.ProviderName; 330 let providerName = properties.VPN.ThirdPartyVPN.ProviderName;
331 if (providerName) 331 if (providerName)
332 return i18n.call('vpnNameTemplate', providerName, name); 332 return i18nBehavior.i18n('vpnNameTemplate', providerName, name);
333 } 333 }
334 } 334 }
335 return name; 335 return name;
336 }; 336 };
337 337
338 /** 338 /**
339 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined} 339 * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined}
340 * properties The ONC network properties or state properties. 340 * properties The ONC network properties or state properties.
341 * @return {boolean} True if |properties| is a Cellular network with a 341 * @return {boolean} True if |properties| is a Cellular network with a
342 * locked SIM. 342 * locked SIM.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 prefixLength += 1; 500 prefixLength += 1;
501 } else if (token == '0') { 501 } else if (token == '0') {
502 prefixLength += 0; 502 prefixLength += 0;
503 } else { 503 } else {
504 // mask is not a valid number. 504 // mask is not a valid number.
505 return -1; 505 return -1;
506 } 506 }
507 } 507 }
508 return prefixLength; 508 return prefixLength;
509 }; 509 };
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/network/cr_network_list_item.js ('k') | ui/webui/resources/js/i18n_behavior.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698