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

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

Issue 1085993002: Revert of Use networkingPrivate.startConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_cellular
Patch Set: 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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 if (hostValue.indexOf(':') !== -1) { 1182 if (hostValue.indexOf(':') !== -1) {
1183 if (hostValue.match(/:/g).length == 1) { 1183 if (hostValue.match(/:/g).length == 1) {
1184 hostValue = hostValue.split(':'); 1184 hostValue = hostValue.split(':');
1185 $(proxyHost).value = hostValue[0]; 1185 $(proxyHost).value = hostValue[0];
1186 $(proxyPort).value = hostValue[1]; 1186 $(proxyPort).value = hostValue[1];
1187 } 1187 }
1188 } 1188 }
1189 }; 1189 };
1190 1190
1191 DetailsInternetPage.loginFromDetails = function() { 1191 DetailsInternetPage.loginFromDetails = function() {
1192 DetailsInternetPage.configureOrConnect();
1193 PageManager.closeOverlay();
1194 };
1195
1196 /**
1197 * This function identifies unconfigured networks and networks that are
1198 * likely to fail (e.g. due to a bad passphrase on a previous connect
1199 * attempt). For such networks a configure dialog will be opened. Otherwise
1200 * a connection will be attempted.
1201 */
1202 DetailsInternetPage.configureOrConnect = function() {
1203 var detailsPage = DetailsInternetPage.getInstance(); 1192 var detailsPage = DetailsInternetPage.getInstance();
1204 if (detailsPage.type_ == 'WiFi') 1193 if (detailsPage.type_ == 'WiFi')
1205 sendChromeMetricsAction('Options_NetworkConnectToWifi'); 1194 sendChromeMetricsAction('Options_NetworkConnectToWifi');
1206 else if (detailsPage.type_ == 'VPN') 1195 else if (detailsPage.type_ == 'VPN')
1207 sendChromeMetricsAction('Options_NetworkConnectToVPN'); 1196 sendChromeMetricsAction('Options_NetworkConnectToVPN');
1208 1197 // TODO(stevenjb): chrome.networkingPrivate.startConnect
1209 var onc = detailsPage.onc_; 1198 chrome.send('startConnect', [detailsPage.onc_.guid()]);
1210 var guid = onc.guid(); 1199 PageManager.closeOverlay();
1211 var type = onc.getActiveValue('Type');
1212
1213 // VPNs do not correctly set 'Connectable', so we always show the
1214 // configuration UI.
1215 if (type == 'VPN') {
1216 chrome.send('configureNetwork', [guid]);
1217 return;
1218 }
1219
1220 // If 'Connectable' is false for WiFi or WiMAX, Shill requires
1221 // additional configuration to connect, so show the configuration UI.
1222 if ((type == 'WiFi' || type == 'WiMAX') &&
1223 !onc.getActiveValue('Connectable')) {
1224 chrome.send('configureNetwork', [guid]);
1225 return;
1226 }
1227
1228 // Secure WiFi networks with ErrorState set most likely require
1229 // configuration (e.g. a correct passphrase) before connecting.
1230 if (type == 'WiFi' && onc.getWiFiSecurity() != 'None') {
1231 var errorState = onc.getActiveValue('ErrorState');
1232 if (errorState && errorState != 'Unknown') {
1233 chrome.send('configureNetwork', [guid]);
1234 return;
1235 }
1236 }
1237
1238 // Cellular networks need to be activated before they can be connected to.
1239 if (type == 'Cellular') {
1240 var activationState = onc.getActiveValue('Cellular.ActivationState');
1241 if (activationState != 'Activated' && activationState != 'Unknown') {
1242 DetailsInternetPage.activateCellular(guid);
1243 return;
1244 }
1245 }
1246
1247 chrome.networkingPrivate.startConnect(guid);
1248 }; 1200 };
1249 1201
1250 DetailsInternetPage.disconnectNetwork = function() { 1202 DetailsInternetPage.disconnectNetwork = function() {
1251 var detailsPage = DetailsInternetPage.getInstance(); 1203 var detailsPage = DetailsInternetPage.getInstance();
1252 if (detailsPage.type_ == 'WiFi') 1204 if (detailsPage.type_ == 'WiFi')
1253 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); 1205 sendChromeMetricsAction('Options_NetworkDisconnectWifi');
1254 else if (detailsPage.type_ == 'VPN') 1206 else if (detailsPage.type_ == 'VPN')
1255 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); 1207 sendChromeMetricsAction('Options_NetworkDisconnectVPN');
1256 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid()); 1208 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid());
1257 PageManager.closeOverlay(); 1209 PageManager.closeOverlay();
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 1785
1834 // Don't show page name in address bar and in history to prevent people 1786 // Don't show page name in address bar and in history to prevent people
1835 // navigate here by hand and solve issue with page session restore. 1787 // navigate here by hand and solve issue with page session restore.
1836 PageManager.showPageByName('detailsInternetPage', false); 1788 PageManager.showPageByName('detailsInternetPage', false);
1837 }; 1789 };
1838 1790
1839 return { 1791 return {
1840 DetailsInternetPage: DetailsInternetPage 1792 DetailsInternetPage: DetailsInternetPage
1841 }; 1793 };
1842 }); 1794 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698