Chromium Code Reviews| 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 1b49bc66ebd33868d30d83b0c0f5379d2a828316..d35f0a31b060f0c4fc4ba783dea731569fab6d32 100644 |
| --- a/chrome/browser/resources/options/chromeos/internet_detail.js |
| +++ b/chrome/browser/resources/options/chromeos/internet_detail.js |
| @@ -1189,14 +1189,56 @@ cr.define('options.internet', function() { |
| }; |
| DetailsInternetPage.loginFromDetails = function() { |
| + DetailsInternetPage.configureOrConnect(); |
| + PageManager.closeOverlay(); |
| + }; |
| + |
| + 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
|
| var detailsPage = DetailsInternetPage.getInstance(); |
| if (detailsPage.type_ == 'WiFi') |
| sendChromeMetricsAction('Options_NetworkConnectToWifi'); |
| else if (detailsPage.type_ == 'VPN') |
| sendChromeMetricsAction('Options_NetworkConnectToVPN'); |
| - // TODO(stevenjb): chrome.networkingPrivate.startConnect |
| - chrome.send('startConnect', [detailsPage.onc_.guid()]); |
| - PageManager.closeOverlay(); |
| + |
| + 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; |
| + } |
| + } |
| + |
| + chrome.networkingPrivate.startConnect(guid); |
| }; |
| DetailsInternetPage.disconnectNetwork = function() { |