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

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: Use guid instead of service_path for proxy prefs 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, DetailsInternetPage.initializeDetailsPage);
169 // as the callback).
170 chrome.send('getManagedProperties', [servicePath]);
171 } 168 }
172 169
173 /** 170 /**
174 * Decorate an element as a NetworkListItem. 171 * Decorate an element as a NetworkListItem.
175 * @param {!Element} el The element to decorate. 172 * @param {!Element} el The element to decorate.
176 */ 173 */
177 NetworkListItem.decorate = function(el) { 174 NetworkListItem.decorate = function(el) {
178 el.__proto__ = NetworkListItem.prototype; 175 el.__proto__ = NetworkListItem.prototype;
179 el.decorate(); 176 el.decorate();
180 }; 177 };
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return networkButtons; 707 return networkButtons;
711 }, 708 },
712 709
713 /** 710 /**
714 * Adds a menu item for showing network details. 711 * Adds a menu item for showing network details.
715 * @param {!Element} parent The parent element. 712 * @param {!Element} parent The parent element.
716 * @param {Object} data Description of the network. 713 * @param {Object} data Description of the network.
717 * @private 714 * @private
718 */ 715 */
719 createNetworkOptionsCallback_: function(parent, data) { 716 createNetworkOptionsCallback_: function(parent, data) {
720 var servicePath = data.servicePath;
721 var menuItem = createCallback_(parent, 717 var menuItem = createCallback_(parent,
722 data, 718 data,
723 getNetworkName(data), 719 getNetworkName(data),
724 showDetails.bind(null, servicePath)); 720 showDetails.bind(null, data.GUID));
725 if (data.policyManaged) 721 if (data.policyManaged)
726 menuItem.appendChild(new ManagedNetworkIndicator()); 722 menuItem.appendChild(new ManagedNetworkIndicator());
727 if (data.ConnectionState == 'Connected' || 723 if (data.ConnectionState == 'Connected' ||
728 data.ConnectionState == 'Connecting') { 724 data.ConnectionState == 'Connecting') {
729 var label = menuItem.getElementsByClassName( 725 var label = menuItem.getElementsByClassName(
730 'network-menu-item-label')[0]; 726 'network-menu-item-label')[0];
731 label.classList.add('active-network'); 727 label.classList.add('active-network');
732 } 728 }
733 } 729 }
734 }; 730 };
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 cellularSupportsScan_ = data.cellularSupportsScan; 1022 cellularSupportsScan_ = data.cellularSupportsScan;
1027 cellularSimAbsent_ = data.cellularSimAbsent; 1023 cellularSimAbsent_ = data.cellularSimAbsent;
1028 cellularSimLockType_ = data.cellularSimLockType; 1024 cellularSimLockType_ = data.cellularSimLockType;
1029 wimaxAvailable_ = data.wimaxAvailable; 1025 wimaxAvailable_ = data.wimaxAvailable;
1030 wimaxEnabled_ = data.wimaxEnabled; 1026 wimaxEnabled_ = data.wimaxEnabled;
1031 1027
1032 // Only show Ethernet control if connected. 1028 // Only show Ethernet control if connected.
1033 var ethernetConnection = getConnection_(data.wiredList); 1029 var ethernetConnection = getConnection_(data.wiredList);
1034 if (ethernetConnection) { 1030 if (ethernetConnection) {
1035 var type = String('Ethernet'); 1031 var type = String('Ethernet');
1036 var path = ethernetConnection.servicePath; 1032 var ethernetOptions = showDetails.bind(null, ethernetConnection.GUID);
1037 var ethernetOptions = function() {
1038 showDetails(path);
1039 };
1040 networkList.update( 1033 networkList.update(
1041 { key: 'Ethernet', 1034 { key: 'Ethernet',
1042 subtitle: loadTimeData.getString('OncConnectionStateConnected'), 1035 subtitle: loadTimeData.getString('OncConnectionStateConnected'),
1043 iconData: ethernetConnection, 1036 iconData: ethernetConnection,
1044 command: ethernetOptions, 1037 command: ethernetOptions,
1045 policyManaged: ethernetConnection.policyManaged } 1038 policyManaged: ethernetConnection.policyManaged }
1046 ); 1039 );
1047 } else { 1040 } else {
1048 networkList.deleteItem('Ethernet'); 1041 networkList.deleteItem('Ethernet');
1049 } 1042 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 /** 1234 /**
1242 * Whether the Network list is disabled. Only used for display purpose. 1235 * Whether the Network list is disabled. Only used for display purpose.
1243 */ 1236 */
1244 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1237 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
1245 1238
1246 // Export 1239 // Export
1247 return { 1240 return {
1248 NetworkList: NetworkList 1241 NetworkList: NetworkList
1249 }; 1242 };
1250 }); 1243 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/internet_detail.js ('k') | chrome/browser/resources/options/chromeos/onc_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698