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

Side by Side Diff: chrome/browser/resources/options/chromeos/network_list.js

Issue 983823002: Use GUID instead of servicePath in network settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_enable_extension_apis
Patch Set: . Created 5 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * This partially describes the network list entries passed to 6 * This partially describes the network list entries passed to
7 * refreshNetworkData. The contents of those lists actually match 7 * refreshNetworkData. The contents of those lists actually match
8 * CrOnc.NetworkConfigType with the addition of the policyManaged and 8 * CrOnc.NetworkConfigType with the addition of the policyManaged property.
9 * servicePath properties. TODO(stevenjb): Use networkingPrivate.getNetworks. 9 * TODO(stevenjb): Use networkingPrivate.getNetworks.
10 * @typedef {{ 10 * @typedef {{
11 * ConnectionState: string, 11 * ConnectionState: string,
12 * GUID: string 12 * GUID: string
13 * Type: string, 13 * Type: string,
14 * policyManaged: boolean, 14 * policyManaged: boolean,
15 * servicePath: string
16 * }} 15 * }}
17 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc 16 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
18 */ 17 */
19 var NetworkInfo; 18 var NetworkInfo;
20 19
21 cr.define('options.network', function() { 20 cr.define('options.network', function() {
22 var ArrayDataModel = cr.ui.ArrayDataModel; 21 var ArrayDataModel = cr.ui.ArrayDataModel;
23 var List = cr.ui.List; 22 var List = cr.ui.List;
24 var ListItem = cr.ui.ListItem; 23 var ListItem = cr.ui.ListItem;
25 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; 24 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 153 }
155 154
156 /** 155 /**
157 * @param {string} action An action to send to coreOptionsUserMetricsAction. 156 * @param {string} action An action to send to coreOptionsUserMetricsAction.
158 */ 157 */
159 function sendChromeMetricsAction(action) { 158 function sendChromeMetricsAction(action) {
160 chrome.send('coreOptionsUserMetricsAction', [action]); 159 chrome.send('coreOptionsUserMetricsAction', [action]);
161 } 160 }
162 161
163 /** 162 /**
164 * @param {string} servicePath The network service path. 163 * @param {string} guid The network GUID.
165 */ 164 */
166 function showDetails(servicePath) { 165 function showDetails(guid) {
167 // TODO(stevenjb): chrome.networkingPrivate.getManagedProperties 166 chrome.networkingPrivate.getManagedProperties(
168 // (Note: we will need to provide DetailsInternetPage.initializeDetailsPage 167 guid, function(oncProperties) {
pneubeck (no reviews) 2015/03/12 20:53:58 nit: as before, anonymous function not required
stevenjb 2015/03/13 01:20:14 Done.
169 // as the callback). 168 DetailsInternetPage.initializeDetailsPage(oncProperties);
170 chrome.send('getManagedProperties', [servicePath]); 169 });
171 } 170 }
172 171
173 /** 172 /**
174 * Decorate an element as a NetworkListItem. 173 * Decorate an element as a NetworkListItem.
175 * @param {!Element} el The element to decorate. 174 * @param {!Element} el The element to decorate.
176 */ 175 */
177 NetworkListItem.decorate = function(el) { 176 NetworkListItem.decorate = function(el) {
178 el.__proto__ = NetworkListItem.prototype; 177 el.__proto__ = NetworkListItem.prototype;
179 el.decorate(); 178 el.decorate();
180 }; 179 };
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return networkButtons; 709 return networkButtons;
711 }, 710 },
712 711
713 /** 712 /**
714 * Adds a menu item for showing network details. 713 * Adds a menu item for showing network details.
715 * @param {!Element} parent The parent element. 714 * @param {!Element} parent The parent element.
716 * @param {Object} data Description of the network. 715 * @param {Object} data Description of the network.
717 * @private 716 * @private
718 */ 717 */
719 createNetworkOptionsCallback_: function(parent, data) { 718 createNetworkOptionsCallback_: function(parent, data) {
720 var servicePath = data.servicePath;
721 var menuItem = createCallback_(parent, 719 var menuItem = createCallback_(parent,
722 data, 720 data,
723 getNetworkName(data), 721 getNetworkName(data),
724 showDetails.bind(null, servicePath)); 722 showDetails.bind(null, data.GUID));
725 if (data.policyManaged) 723 if (data.policyManaged)
726 menuItem.appendChild(new ManagedNetworkIndicator()); 724 menuItem.appendChild(new ManagedNetworkIndicator());
727 if (data.ConnectionState == 'Connected' || 725 if (data.ConnectionState == 'Connected' ||
728 data.ConnectionState == 'Connecting') { 726 data.ConnectionState == 'Connecting') {
729 var label = menuItem.getElementsByClassName( 727 var label = menuItem.getElementsByClassName(
730 'network-menu-item-label')[0]; 728 'network-menu-item-label')[0];
731 label.classList.add('active-network'); 729 label.classList.add('active-network');
732 } 730 }
733 } 731 }
734 }; 732 };
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 cellularSupportsScan_ = data.cellularSupportsScan; 1024 cellularSupportsScan_ = data.cellularSupportsScan;
1027 cellularSimAbsent_ = data.cellularSimAbsent; 1025 cellularSimAbsent_ = data.cellularSimAbsent;
1028 cellularSimLockType_ = data.cellularSimLockType; 1026 cellularSimLockType_ = data.cellularSimLockType;
1029 wimaxAvailable_ = data.wimaxAvailable; 1027 wimaxAvailable_ = data.wimaxAvailable;
1030 wimaxEnabled_ = data.wimaxEnabled; 1028 wimaxEnabled_ = data.wimaxEnabled;
1031 1029
1032 // Only show Ethernet control if connected. 1030 // Only show Ethernet control if connected.
1033 var ethernetConnection = getConnection_(data.wiredList); 1031 var ethernetConnection = getConnection_(data.wiredList);
1034 if (ethernetConnection) { 1032 if (ethernetConnection) {
1035 var type = String('Ethernet'); 1033 var type = String('Ethernet');
1036 var path = ethernetConnection.servicePath; 1034 var guid = ethernetConnection.GUID;
1037 var ethernetOptions = function() { 1035 var ethernetOptions = function() {
pneubeck (no reviews) 2015/03/12 20:53:58 nit: ... = showDetails.bind(null, ethernetConnecti
stevenjb 2015/03/13 01:20:14 Done.
1038 showDetails(path); 1036 showDetails(guid);
1039 }; 1037 };
1040 networkList.update( 1038 networkList.update(
1041 { key: 'Ethernet', 1039 { key: 'Ethernet',
1042 subtitle: loadTimeData.getString('OncConnectionStateConnected'), 1040 subtitle: loadTimeData.getString('OncConnectionStateConnected'),
1043 iconData: ethernetConnection, 1041 iconData: ethernetConnection,
1044 command: ethernetOptions, 1042 command: ethernetOptions,
1045 policyManaged: ethernetConnection.policyManaged } 1043 policyManaged: ethernetConnection.policyManaged }
1046 ); 1044 );
1047 } else { 1045 } else {
1048 networkList.deleteItem('Ethernet'); 1046 networkList.deleteItem('Ethernet');
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 /** 1239 /**
1242 * Whether the Network list is disabled. Only used for display purpose. 1240 * Whether the Network list is disabled. Only used for display purpose.
1243 */ 1241 */
1244 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1242 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
1245 1243
1246 // Export 1244 // Export
1247 return { 1245 return {
1248 NetworkList: NetworkList 1246 NetworkList: NetworkList
1249 }; 1247 };
1250 }); 1248 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698