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

Unified Diff: chrome/browser/resources/settings/internet_page/network_summary.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, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/internet_page/network_summary.js
diff --git a/chrome/browser/resources/settings/internet_page/network_summary.js b/chrome/browser/resources/settings/internet_page/network_summary.js
index f34bba6ebe9be6e9455947c8b8036f3e87ad0da7..f7a6a3c29eee7680ac89d6afdb8e57c3f7f7c8ea 100644
--- a/chrome/browser/resources/settings/internet_page/network_summary.js
+++ b/chrome/browser/resources/settings/internet_page/network_summary.js
@@ -52,7 +52,9 @@ Polymer({
*/
deviceStates: {
type: Object,
- value: function() { return {}; },
+ value: function() {
+ return {};
+ },
},
/**
@@ -61,7 +63,9 @@ Polymer({
*/
activeNetworkStates: {
type: Array,
- value: function() { return []; },
+ value: function() {
+ return [];
+ },
},
/**
@@ -70,7 +74,9 @@ Polymer({
*/
networkStateLists: {
type: Object,
- value: function() { return {}; },
+ value: function() {
+ return {};
+ },
},
/**
@@ -188,13 +194,17 @@ Polymer({
* networkingPrivate.onNetworkListChanged event callback.
* @private
*/
- onNetworkListChangedEvent_: function() { this.getNetworkLists_(); },
+ onNetworkListChangedEvent_: function() {
+ this.getNetworkLists_();
+ },
/**
* networkingPrivate.onDeviceStateListChanged event callback.
* @private
*/
- onDeviceStateListChangedEvent_: function() { this.getNetworkLists_(); },
+ onDeviceStateListChangedEvent_: function() {
+ this.getNetworkLists_();
+ },
/**
* networkingPrivate.onNetworksChanged event callback.
@@ -366,12 +376,19 @@ Polymer({
});
}
- // Push the active networks onto newActiveNetworkStates in device order,
- // creating an empty state for devices with no networks.
- var newActiveNetworkStates = [];
+ // Push the active networks onto newActiveNetworkStates in order based on
+ // device priority, creating an empty state for devices with no networks.
+ let newActiveNetworkStates = [];
this.activeNetworkIds_ = new Set;
- for (let type in newDeviceStates) {
- var state = activeNetworkStatesByType.get(type) || {GUID: '', Type: type};
+ let orderedDeviceTypes = [
+ CrOnc.Type.ETHERNET, CrOnc.Type.WI_FI, CrOnc.Type.CELLULAR,
+ CrOnc.Type.WI_MAX, CrOnc.Type.VPN
+ ];
+ for (let type of orderedDeviceTypes) {
+ let device = newDeviceStates[type];
+ if (!device)
+ continue;
+ let state = activeNetworkStatesByType.get(type) || {GUID: '', Type: type};
newActiveNetworkStates.push(state);
this.activeNetworkIds_.add(state.GUID);
}

Powered by Google App Engine
This is Rietveld 408576698