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

Side by Side Diff: ui/webui/resources/cr_elements/network/cr_network_list_item.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 Polymer element for displaying information about a network 6 * @fileoverview Polymer element for displaying information about a network
7 * in a list or summary based on ONC state properties. 7 * in a list or summary based on ONC state properties.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 getItemName_: function() { 84 getItemName_: function() {
85 if (this.item.hasOwnProperty('customItemName')) { 85 if (this.item.hasOwnProperty('customItemName')) {
86 let item = /** @type {!CrNetworkList.CustomItemState} */ (this.item); 86 let item = /** @type {!CrNetworkList.CustomItemState} */ (this.item);
87 let name = item.customItemName || ''; 87 let name = item.customItemName || '';
88 if (this.i18nExists(item.customItemName)) 88 if (this.i18nExists(item.customItemName))
89 name = this.i18n(item.customItemName); 89 name = this.i18n(item.customItemName);
90 return name; 90 return name;
91 } 91 }
92 let network = /** @type {!CrOnc.NetworkStateProperties} */ (this.item); 92 let network = /** @type {!CrOnc.NetworkStateProperties} */ (this.item);
93 if (this.isListItem) 93 if (this.isListItem)
94 return CrOnc.getNetworkName(network, this.i18n); 94 return CrOnc.getNetworkName(network, this);
95 return this.i18n('OncType' + network.Type); 95 return this.i18n('OncType' + network.Type);
96 }, 96 },
97 97
98 /** @private */ 98 /** @private */
99 isStateTextVisible_() { 99 isStateTextVisible_() {
100 return !!this.networkState && (!this.isListItem || this.isConnected_()); 100 return !!this.networkState && (!this.isListItem || this.isConnected_());
101 }, 101 },
102 102
103 /** @private */ 103 /** @private */
104 isStateTextConnected_() { 104 isStateTextConnected_() {
105 return this.isListItem && this.isConnected_(); 105 return this.isListItem && this.isConnected_();
106 }, 106 },
107 107
108 /** 108 /**
109 * This only gets called for network items once networkState is set. 109 * This only gets called for network items once networkState is set.
110 * @private 110 * @private
111 */ 111 */
112 getNetworkStateText_: function() { 112 getNetworkStateText_: function() {
113 if (!this.isStateTextVisible_()) 113 if (!this.isStateTextVisible_())
114 return ''; 114 return '';
115 let network = this.networkState; 115 let network = this.networkState;
116 if (this.isListItem) 116 if (this.isListItem)
117 return this.i18n('networkListItemConnected'); 117 return this.i18n('networkListItemConnected');
118 if (network.Name && network.ConnectionState) { 118 if (network.Name && network.ConnectionState) {
119 return this.getConnectionStateText_( 119 return this.getConnectionStateText_(
120 network.ConnectionState, CrOnc.getNetworkName(network, this.i18n)); 120 network.ConnectionState, CrOnc.getNetworkName(network, this));
121 } 121 }
122 return this.i18n('networkDisabled'); 122 return this.i18n('networkDisabled');
123 }, 123 },
124 124
125 /** 125 /**
126 * Returns the appropriate connection state text. 126 * Returns the appropriate connection state text.
127 * @param {string} state The connection state. 127 * @param {string} state The connection state.
128 * @param {string} name The name of the network. 128 * @param {string} name The name of the network.
129 * @return {string} 129 * @return {string}
130 */ 130 */
(...skipping 26 matching lines...) Expand all
157 * Fires a 'show-details' event with |this.networkState| as the details. 157 * Fires a 'show-details' event with |this.networkState| as the details.
158 * @param {Event} event 158 * @param {Event} event
159 * @private 159 * @private
160 */ 160 */
161 fireShowDetails_: function(event) { 161 fireShowDetails_: function(event) {
162 assert(this.networkState); 162 assert(this.networkState);
163 this.fire('show-detail', this.networkState); 163 this.fire('show-detail', this.networkState);
164 event.stopPropagation(); 164 event.stopPropagation();
165 }, 165 },
166 }); 166 });
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/network/compiled_resources2.gyp ('k') | ui/webui/resources/cr_elements/network/cr_onc_types.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698