Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 1170 // Unconfigured networks, VPNs, and secure WiFi networks with ErrorState | |
| 1171 // set require configuration before they can be connected to. | |
| 1172 if (!onc.getActiveValue('Connectable') || (detailsPage.type_ == 'VPN') || | |
|
armansito
2015/04/01 00:41:54
Won't this lead to a call to 'configureNetwork' if
stevenjb
2015/04/01 20:53:39
In theory that should be correct; if 'Connectable'
| |
| 1173 (detailsPage.type_ == 'WiFi' && onc.getActiveValue('ErrorState') && | |
| 1174 onc.getWiFiSecurity() != 'None')) { | |
| 1175 chrome.send('configureNetwork', [guid]); | |
| 1176 return; | |
| 1177 } | |
| 1178 | |
| 1179 if (detailsPage.type_ == 'Cellular') { | |
| 1180 var activationState = onc.getActiveValue('Cellular.ActivationState'); | |
| 1181 if (activationState != 'Activated' && activationState != 'Unknown') { | |
| 1182 DetailsInternetPage.activateCellular(guid); | |
| 1183 return; | |
| 1184 } | |
| 1185 } | |
| 1186 chrome.networkingPrivate.startConnect(guid); | |
| 1168 PageManager.closeOverlay(); | 1187 PageManager.closeOverlay(); |
| 1169 }; | 1188 }; |
| 1170 | 1189 |
| 1171 DetailsInternetPage.disconnectNetwork = function() { | 1190 DetailsInternetPage.disconnectNetwork = function() { |
| 1172 var detailsPage = DetailsInternetPage.getInstance(); | 1191 var detailsPage = DetailsInternetPage.getInstance(); |
| 1173 if (detailsPage.type_ == 'WiFi') | 1192 if (detailsPage.type_ == 'WiFi') |
| 1174 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); | 1193 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); |
| 1175 else if (detailsPage.type_ == 'VPN') | 1194 else if (detailsPage.type_ == 'VPN') |
| 1176 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); | 1195 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); |
| 1177 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid()); | 1196 chrome.networkingPrivate.startDisconnect(detailsPage.onc_.guid()); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1765 | 1784 |
| 1766 // Don't show page name in address bar and in history to prevent people | 1785 // 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. | 1786 // navigate here by hand and solve issue with page session restore. |
| 1768 PageManager.showPageByName('detailsInternetPage', false); | 1787 PageManager.showPageByName('detailsInternetPage', false); |
| 1769 }; | 1788 }; |
| 1770 | 1789 |
| 1771 return { | 1790 return { |
| 1772 DetailsInternetPage: DetailsInternetPage | 1791 DetailsInternetPage: DetailsInternetPage |
| 1773 }; | 1792 }; |
| 1774 }); | 1793 }); |
| OLD | NEW |