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

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

Issue 1043343002: Use networkingPrivate.startConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_cellular
Patch Set: Separate out logic and use last_error Created 5 years, 8 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 // require: onc_data.js 5 // require: onc_data.js
6 6
7 // NOTE(stevenjb): This code is in the process of being converted to be 7 // NOTE(stevenjb): This code is in the process of being converted to be
8 // compatible with the networkingPrivate extension API: 8 // compatible with the networkingPrivate extension API:
9 // * The network property dictionaries are being converted to use ONC values. 9 // * The network property dictionaries are being converted to use ONC values.
10 // * chrome.send calls will be replaced with chrome.networkingPrivate calls. 10 // * chrome.send calls will be replaced with chrome.networkingPrivate calls.
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1156 }
1157 } 1157 }
1158 }; 1158 };
1159 1159
1160 DetailsInternetPage.loginFromDetails = function() { 1160 DetailsInternetPage.loginFromDetails = function() {
1161 var detailsPage = DetailsInternetPage.getInstance(); 1161 var detailsPage = DetailsInternetPage.getInstance();
1162 if (detailsPage.type_ == 'WiFi') 1162 if (detailsPage.type_ == 'WiFi')
1163 sendChromeMetricsAction('Options_NetworkConnectToWifi'); 1163 sendChromeMetricsAction('Options_NetworkConnectToWifi');
1164 else if (detailsPage.type_ == 'VPN') 1164 else if (detailsPage.type_ == 'VPN')
1165 sendChromeMetricsAction('Options_NetworkConnectToVPN'); 1165 sendChromeMetricsAction('Options_NetworkConnectToVPN');
1166 // TODO(stevenjb): chrome.networkingPrivate.startConnect 1166
1167 chrome.send('startConnect', [detailsPage.onc_.guid()]); 1167 var onc = detailsPage.onc_;
1168 var guid = onc.guid();
1169 var type = onc.getActiveValue('Type');
1170
1171 // VPNs do not correctly set 'Connectable', so we always show the
1172 // configuration UI.
1173 if (type == 'VPN') {
1174 chrome.send('configureNetwork', [guid]);
1175 return;
1176 }
1177
1178 // If 'Connectable' is false for WiFi or WiMAX, Shill requires
1179 // additional configuration to connect, so show the configuration UI.
1180 if ((type == 'WiFi' || type == 'WiMAX') &&
1181 !onc.getActiveValue('Connectable')) {
1182 chrome.send('configureNetwork', [guid]);
1183 return;
1184 }
1185
1186 // Secure WiFi networks with ErrorState set most likely require
1187 // configuration (e.g. a correct passphrase) before connecting.
1188 if (type == 'WiFi' && onc.getWiFiSecurity() != 'None') {
1189 var errorState = onc.getActiveValue('ErrorState');
1190 if (errorState && errorState != 'Unknown') {
1191 chrome.send('configureNetwork', [guid]);
1192 return;
1193 }
1194 }
1195
1196 // Cellular networks need to be activated before they can be connected to.
1197 if (type == 'Cellular') {
1198 var activationState = onc.getActiveValue('Cellular.ActivationState');
1199 if (activationState != 'Activated' && activationState != 'Unknown') {
1200 DetailsInternetPage.activateCellular(guid);
1201 return;
1202 }
1203 }
michaelpg 2015/04/03 17:54:11 nit: newline after
stevenjb 2015/04/06 20:27:12 Done.
1204 chrome.networkingPrivate.startConnect(guid);
1168 PageManager.closeOverlay(); 1205 PageManager.closeOverlay();
michaelpg 2015/04/03 17:54:11 how does this work? I click "log in", hit one of t
stevenjb 2015/04/06 20:27:12 Good catch. We should call closeOverlay regardless
1169 }; 1206 };
1170 1207
1171 DetailsInternetPage.disconnectNetwork = function() { 1208 DetailsInternetPage.disconnectNetwork = function() {
1172 var detailsPage = DetailsInternetPage.getInstance(); 1209 var detailsPage = DetailsInternetPage.getInstance();
1173 if (detailsPage.type_ == 'WiFi') 1210 if (detailsPage.type_ == 'WiFi')
1174 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); 1211 sendChromeMetricsAction('Options_NetworkDisconnectWifi');
1175 else if (detailsPage.type_ == 'VPN') 1212 else if (detailsPage.type_ == 'VPN')
1176 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); 1213 sendChromeMetricsAction('Options_NetworkDisconnectVPN');
1177 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid()); 1214 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid());
1178 PageManager.closeOverlay(); 1215 PageManager.closeOverlay();
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 1802
1766 // Don't show page name in address bar and in history to prevent people 1803 // Don't show page name in address bar and in history to prevent people
1767 // navigate here by hand and solve issue with page session restore. 1804 // navigate here by hand and solve issue with page session restore.
1768 PageManager.showPageByName('detailsInternetPage', false); 1805 PageManager.showPageByName('detailsInternetPage', false);
1769 }; 1806 };
1770 1807
1771 return { 1808 return {
1772 DetailsInternetPage: DetailsInternetPage 1809 DetailsInternetPage: DetailsInternetPage
1773 }; 1810 };
1774 }); 1811 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698