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

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

Issue 2290853002: MD Settings: Use network name for detail page title (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
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 a summary of network states 6 * @fileoverview Polymer element for displaying a summary of network states
7 * by type: Ethernet, WiFi, Cellular, WiMAX, and VPN. 7 * by type: Ethernet, WiFi, Cellular, WiMAX, and VPN.
8 */ 8 */
9 9
10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ 10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 newDeviceStates[state.Type] = state; 328 newDeviceStates[state.Type] = state;
329 } else { 329 } else {
330 newDeviceStates = this.deviceStates; 330 newDeviceStates = this.deviceStates;
331 } 331 }
332 332
333 // Clear any current networks. 333 // Clear any current networks.
334 var activeNetworkStatesByType = 334 var activeNetworkStatesByType =
335 /** @type {!Map<string, !CrOnc.NetworkStateProperties>} */ (new Map); 335 /** @type {!Map<string, !CrOnc.NetworkStateProperties>} */ (new Map);
336 336
337 // Complete list of states by type. 337 // Complete list of states by type.
338 /** @type {!NetworkStateListObject} */ var newNetworkStateLists = { 338 /** @type {!NetworkStateListObject} */ var newNetworkStateLists = {
dschuyler 2016/08/30 00:50:01 Optional: I'm used to seeing the var on the line a
stevenjb 2016/08/30 15:36:49 This is how clang formats it. I do not argue with
339 Ethernet: [], 339 Ethernet: [],
340 WiFi: [], 340 WiFi: [],
341 Cellular: [], 341 Cellular: [],
342 WiMAX: [], 342 WiMAX: [],
343 VPN: [], 343 VPN: [],
344 }; 344 };
345 345
346 var firstConnectedNetwork = null; 346 var firstConnectedNetwork = null;
347 networkStates.forEach(function(state) { 347 networkStates.forEach(function(state) {
348 let type = state.Type; 348 let type = state.Type;
(...skipping 22 matching lines...) Expand all
371 var newActiveNetworkStates = []; 371 var newActiveNetworkStates = [];
372 this.activeNetworkIds_ = new Set; 372 this.activeNetworkIds_ = new Set;
373 for (let type in newDeviceStates) { 373 for (let type in newDeviceStates) {
374 var state = activeNetworkStatesByType.get(type) || {GUID: '', Type: type}; 374 var state = activeNetworkStatesByType.get(type) || {GUID: '', Type: type};
375 newActiveNetworkStates.push(state); 375 newActiveNetworkStates.push(state);
376 this.activeNetworkIds_.add(state.GUID); 376 this.activeNetworkIds_.add(state.GUID);
377 } 377 }
378 378
379 this.deviceStates = newDeviceStates; 379 this.deviceStates = newDeviceStates;
380 this.networkStateLists = newNetworkStateLists; 380 this.networkStateLists = newNetworkStateLists;
381 // Set activeNetworkStates last to rebuild the dom-repeat. 381
382 // Sort and set activeNetworkStates last to rebuild the dom-repeat.
383 var networkTypeSortOrder = [
384 CrOnc.Type.ETHERNET, CrOnc.Type.WI_FI, CrOnc.Type.CELLULAR,
385 CrOnc.Type.WI_MAX, CrOnc.Type.VPN
386 ];
387 newActiveNetworkStates.sort(function(a, b) {
388 return networkTypeSortOrder.indexOf(a.Type) -
389 networkTypeSortOrder.indexOf(a.Type);
390 });
dschuyler 2016/08/30 00:50:01 This looks like the same sort order could be gaine
dschuyler 2016/08/30 00:55:37 Whoops that ~7 is mixing JS calls and array iterat
stevenjb 2016/08/30 15:36:49 The sort is likely to be trivial compared to the m
382 this.activeNetworkStates = newActiveNetworkStates; 391 this.activeNetworkStates = newActiveNetworkStates;
383 }, 392 },
384 }); 393 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698