OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 observers_.RemoveObserver(observer); | 80 observers_.RemoveObserver(observer); |
81 } | 81 } |
82 | 82 |
83 void NetworkLibraryImpl::RequestWifiScan() { | 83 void NetworkLibraryImpl::RequestWifiScan() { |
84 if (CrosLibrary::Get()->EnsureLoaded()) { | 84 if (CrosLibrary::Get()->EnsureLoaded()) { |
85 RequestScan(TYPE_WIFI); | 85 RequestScan(TYPE_WIFI); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 void NetworkLibraryImpl::ConnectToWifiNetwork(WifiNetwork network, | 89 void NetworkLibraryImpl::ConnectToWifiNetwork(WifiNetwork network, |
90 const string16& password) { | 90 const string16& password, |
| 91 const string16& identity, |
| 92 const string16& certpath) { |
91 if (CrosLibrary::Get()->EnsureLoaded()) { | 93 if (CrosLibrary::Get()->EnsureLoaded()) { |
92 ConnectToNetwork(network.service_path.c_str(), | 94 ConnectToNetworkWithCertInfo(network.service_path.c_str(), |
93 password.empty() ? NULL : UTF16ToUTF8(password).c_str()); | 95 password.empty() ? NULL : UTF16ToUTF8(password).c_str(), |
| 96 identity.empty() ? NULL : UTF16ToUTF8(identity).c_str(), |
| 97 certpath.empty() ? NULL : UTF16ToUTF8(certpath).c_str()); |
94 } | 98 } |
95 } | 99 } |
96 | 100 |
97 void NetworkLibraryImpl::ConnectToWifiNetwork(const string16& ssid, | 101 void NetworkLibraryImpl::ConnectToWifiNetwork(const string16& ssid, |
98 const string16& password) { | 102 const string16& password, |
| 103 const string16& identity, |
| 104 const string16& certpath) { |
99 if (CrosLibrary::Get()->EnsureLoaded()) { | 105 if (CrosLibrary::Get()->EnsureLoaded()) { |
100 // First create a service from hidden network. | 106 // First create a service from hidden network. |
101 ServiceInfo* service = GetWifiService(UTF16ToUTF8(ssid).c_str(), | 107 ServiceInfo* service = GetWifiService(UTF16ToUTF8(ssid).c_str(), |
102 SECURITY_UNKNOWN); | 108 SECURITY_UNKNOWN); |
103 // Now connect to that service. | 109 // Now connect to that service. |
104 if (service) { | 110 if (service) { |
105 ConnectToNetwork(service->service_path, | 111 ConnectToNetworkWithCertInfo(service->service_path, |
106 password.empty() ? NULL : UTF16ToUTF8(password).c_str()); | 112 password.empty() ? NULL : UTF16ToUTF8(password).c_str(), |
| 113 identity.empty() ? NULL : UTF16ToUTF8(identity).c_str(), |
| 114 certpath.empty() ? NULL : UTF16ToUTF8(certpath).c_str()); |
| 115 |
107 // Clean up ServiceInfo object. | 116 // Clean up ServiceInfo object. |
108 FreeServiceInfo(service); | 117 FreeServiceInfo(service); |
109 } else { | 118 } else { |
110 LOG(WARNING) << "Cannot find hidden network: " << ssid; | 119 LOG(WARNING) << "Cannot find hidden network: " << ssid; |
111 // TODO(chocobo): Show error message. | 120 // TODO(chocobo): Show error message. |
112 } | 121 } |
113 } | 122 } |
114 } | 123 } |
115 | 124 |
116 void NetworkLibraryImpl::ConnectToCellularNetwork(CellularNetwork network) { | 125 void NetworkLibraryImpl::ConnectToCellularNetwork(CellularNetwork network) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (ethernet_connected()) | 425 if (ethernet_connected()) |
417 return ethernet_.ip_address; | 426 return ethernet_.ip_address; |
418 if (wifi_connected()) | 427 if (wifi_connected()) |
419 return wifi_.ip_address; | 428 return wifi_.ip_address; |
420 if (cellular_connected()) | 429 if (cellular_connected()) |
421 return cellular_.ip_address; | 430 return cellular_.ip_address; |
422 return ethernet_.ip_address; | 431 return ethernet_.ip_address; |
423 } | 432 } |
424 | 433 |
425 } // namespace chromeos | 434 } // namespace chromeos |
OLD | NEW |