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

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: Rebase 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 DetailsInternetPage.configureOrConnect = function() {
pneubeck (no reviews) 2015/04/13 19:16:11 can you explain whether this has the same behavior
stevenjb 2015/04/13 21:16:31 The intention is that this will identify unconfigu
1192 var detailsPage = DetailsInternetPage.getInstance(); 1197 var detailsPage = DetailsInternetPage.getInstance();
1193 if (detailsPage.type_ == 'WiFi') 1198 if (detailsPage.type_ == 'WiFi')
1194 sendChromeMetricsAction('Options_NetworkConnectToWifi'); 1199 sendChromeMetricsAction('Options_NetworkConnectToWifi');
1195 else if (detailsPage.type_ == 'VPN') 1200 else if (detailsPage.type_ == 'VPN')
1196 sendChromeMetricsAction('Options_NetworkConnectToVPN'); 1201 sendChromeMetricsAction('Options_NetworkConnectToVPN');
1197 // TODO(stevenjb): chrome.networkingPrivate.startConnect 1202
1198 chrome.send('startConnect', [detailsPage.onc_.guid()]); 1203 var onc = detailsPage.onc_;
1199 PageManager.closeOverlay(); 1204 var guid = onc.guid();
1205 var type = onc.getActiveValue('Type');
1206
1207 // VPNs do not correctly set 'Connectable', so we always show the
1208 // configuration UI.
1209 if (type == 'VPN') {
1210 chrome.send('configureNetwork', [guid]);
1211 return;
1212 }
1213
1214 // If 'Connectable' is false for WiFi or WiMAX, Shill requires
1215 // additional configuration to connect, so show the configuration UI.
1216 if ((type == 'WiFi' || type == 'WiMAX') &&
1217 !onc.getActiveValue('Connectable')) {
1218 chrome.send('configureNetwork', [guid]);
1219 return;
1220 }
1221
1222 // Secure WiFi networks with ErrorState set most likely require
1223 // configuration (e.g. a correct passphrase) before connecting.
1224 if (type == 'WiFi' && onc.getWiFiSecurity() != 'None') {
1225 var errorState = onc.getActiveValue('ErrorState');
1226 if (errorState && errorState != 'Unknown') {
1227 chrome.send('configureNetwork', [guid]);
1228 return;
1229 }
1230 }
1231
1232 // Cellular networks need to be activated before they can be connected to.
1233 if (type == 'Cellular') {
1234 var activationState = onc.getActiveValue('Cellular.ActivationState');
1235 if (activationState != 'Activated' && activationState != 'Unknown') {
1236 DetailsInternetPage.activateCellular(guid);
1237 return;
1238 }
1239 }
1240
1241 chrome.networkingPrivate.startConnect(guid);
1200 }; 1242 };
1201 1243
1202 DetailsInternetPage.disconnectNetwork = function() { 1244 DetailsInternetPage.disconnectNetwork = function() {
1203 var detailsPage = DetailsInternetPage.getInstance(); 1245 var detailsPage = DetailsInternetPage.getInstance();
1204 if (detailsPage.type_ == 'WiFi') 1246 if (detailsPage.type_ == 'WiFi')
1205 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); 1247 sendChromeMetricsAction('Options_NetworkDisconnectWifi');
1206 else if (detailsPage.type_ == 'VPN') 1248 else if (detailsPage.type_ == 'VPN')
1207 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); 1249 sendChromeMetricsAction('Options_NetworkDisconnectVPN');
1208 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid()); 1250 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid());
1209 PageManager.closeOverlay(); 1251 PageManager.closeOverlay();
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 1827
1786 // Don't show page name in address bar and in history to prevent people 1828 // Don't show page name in address bar and in history to prevent people
1787 // navigate here by hand and solve issue with page session restore. 1829 // navigate here by hand and solve issue with page session restore.
1788 PageManager.showPageByName('detailsInternetPage', false); 1830 PageManager.showPageByName('detailsInternetPage', false);
1789 }; 1831 };
1790 1832
1791 return { 1833 return {
1792 DetailsInternetPage: DetailsInternetPage 1834 DetailsInternetPage: DetailsInternetPage
1793 }; 1835 };
1794 }); 1836 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698