Index: chrome/browser/resources/options/chromeos/internet_detail.js |
diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js |
index 7193f7905f91c87145161b68bfb15e0169ebb0a3..be9a8960d53ec5e7c7d87c69f0b148504bbccba8 100644 |
--- a/chrome/browser/resources/options/chromeos/internet_detail.js |
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js |
@@ -1163,8 +1163,45 @@ cr.define('options.internet', function() { |
sendChromeMetricsAction('Options_NetworkConnectToWifi'); |
else if (detailsPage.type_ == 'VPN') |
sendChromeMetricsAction('Options_NetworkConnectToVPN'); |
- // TODO(stevenjb): chrome.networkingPrivate.startConnect |
- chrome.send('startConnect', [detailsPage.onc_.guid()]); |
+ |
+ var onc = detailsPage.onc_; |
+ var guid = onc.guid(); |
+ var type = onc.getActiveValue('Type'); |
+ |
+ // VPNs do not correctly set 'Connectable', so we always show the |
+ // configuration UI. |
+ if (type == 'VPN') { |
+ chrome.send('configureNetwork', [guid]); |
+ return; |
+ } |
+ |
+ // If 'Connectable' is false for WiFi or WiMAX, Shill requires |
+ // additional configuration to connect, so show the configuration UI. |
+ if ((type == 'WiFi' || type == 'WiMAX') && |
+ !onc.getActiveValue('Connectable')) { |
+ chrome.send('configureNetwork', [guid]); |
+ return; |
+ } |
+ |
+ // Secure WiFi networks with ErrorState set most likely require |
+ // configuration (e.g. a correct passphrase) before connecting. |
+ if (type == 'WiFi' && onc.getWiFiSecurity() != 'None') { |
+ var errorState = onc.getActiveValue('ErrorState'); |
+ if (errorState && errorState != 'Unknown') { |
+ chrome.send('configureNetwork', [guid]); |
+ return; |
+ } |
+ } |
+ |
+ // Cellular networks need to be activated before they can be connected to. |
+ if (type == 'Cellular') { |
+ var activationState = onc.getActiveValue('Cellular.ActivationState'); |
+ if (activationState != 'Activated' && activationState != 'Unknown') { |
+ DetailsInternetPage.activateCellular(guid); |
+ return; |
+ } |
+ } |
michaelpg
2015/04/03 17:54:11
nit: newline after
stevenjb
2015/04/06 20:27:12
Done.
|
+ chrome.networkingPrivate.startConnect(guid); |
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
|
}; |