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

Side by Side Diff: chrome/browser/resources/settings/internet_page/internet_detail_page.js

Issue 2290853002: MD Settings: Use network name for detail page title (Closed)
Patch Set: Rebase + use ordered array of types instead of sort 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 6 * @fileoverview
7 * 'settings-internet-detail' is the settings subpage containing details 7 * 'settings-internet-detail' is the settings subpage containing details
8 * for a network. 8 * for a network.
9 */ 9 */
10 (function() { 10 (function() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 var priority = /** @type {number} */ ( 149 var priority = /** @type {number} */ (
150 CrOnc.getActiveValue(this.networkProperties.Priority) || 0); 150 CrOnc.getActiveValue(this.networkProperties.Priority) || 0);
151 var preferNetwork = priority > 0; 151 var preferNetwork = priority > 0;
152 if (preferNetwork != this.preferNetwork) 152 if (preferNetwork != this.preferNetwork)
153 this.preferNetwork = preferNetwork; 153 this.preferNetwork = preferNetwork;
154 154
155 // Set the IPAddress property to the IPV4 Address. 155 // Set the IPAddress property to the IPV4 Address.
156 var ipv4 = 156 var ipv4 =
157 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); 157 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
158 this.IPAddress = (ipv4 && ipv4.IPAddress) || ''; 158 this.IPAddress = (ipv4 && ipv4.IPAddress) || '';
159
160 // Update the detail page title.
161 this.parentNode.pageTitle =
162 CrOnc.getNetworkName(this.networkProperties, this.i18n);
159 }, 163 },
160 164
161 /** @private */ 165 /** @private */
162 autoConnectChanged_: function() { 166 autoConnectChanged_: function() {
163 if (!this.networkProperties || !this.guid) 167 if (!this.networkProperties || !this.guid)
164 return; 168 return;
165 var onc = this.getEmptyNetworkProperties_(); 169 var onc = this.getEmptyNetworkProperties_();
166 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect); 170 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect);
167 this.setNetworkProperties_(onc); 171 this.setNetworkProperties_(onc);
168 }, 172 },
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 * @return {!chrome.networkingPrivate.NetworkConfigProperties} An ONC 235 * @return {!chrome.networkingPrivate.NetworkConfigProperties} An ONC
232 * dictionary with just the Type property set. Used for passing properties 236 * dictionary with just the Type property set. Used for passing properties
233 * to setNetworkProperties_. 237 * to setNetworkProperties_.
234 * @private 238 * @private
235 */ 239 */
236 getEmptyNetworkProperties_: function() { 240 getEmptyNetworkProperties_: function() {
237 return {Type: this.networkProperties.Type}; 241 return {Type: this.networkProperties.Type};
238 }, 242 },
239 243
240 /** 244 /**
241 * @return {string} The text to display for the network name.
242 * @private
243 */
244 getStateName_: function() {
245 return /** @type {string} */ (
246 CrOnc.getActiveValue(this.networkProperties.Name) || '');
247 },
248
249 /**
250 * @return {string} The text to display for the network connection state. 245 * @return {string} The text to display for the network connection state.
251 * @private 246 * @private
252 */ 247 */
253 getStateText_: function() { 248 getStateText_: function() {
254 return this.i18n('Onc' + this.networkProperties.ConnectionState); 249 return this.i18n('Onc' + this.networkProperties.ConnectionState);
255 }, 250 },
256 251
257 /** 252 /**
258 * @return {boolean} True if the network is connected. 253 * @return {boolean} True if the network is connected.
259 * @private 254 * @private
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 */ 737 */
743 allPropertiesMatch_: function(curValue, newValue) { 738 allPropertiesMatch_: function(curValue, newValue) {
744 for (let key in newValue) { 739 for (let key in newValue) {
745 if (newValue[key] != curValue[key]) 740 if (newValue[key] != curValue[key])
746 return false; 741 return false;
747 } 742 }
748 return true; 743 return true;
749 } 744 }
750 }); 745 });
751 })(); 746 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698