OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 wifi->set_passphrase(password); | 699 wifi->set_passphrase(password); |
700 wifi->set_identity(identity); | 700 wifi->set_identity(identity); |
701 wifi->set_cert_path(certpath); | 701 wifi->set_cert_path(certpath); |
702 wifi->set_connecting(true); | 702 wifi->set_connecting(true); |
703 wifi_ = wifi; | 703 wifi_ = wifi; |
704 } | 704 } |
705 NotifyNetworkChanged(); | 705 NotifyNetworkChanged(); |
706 } | 706 } |
707 } | 707 } |
708 | 708 |
709 virtual void ConnectToWifiNetwork(const std::string& ssid, | 709 virtual void ConnectToWifiNetwork(ConnectionSecurity security, |
| 710 const std::string& ssid, |
710 const std::string& password, | 711 const std::string& password, |
711 const std::string& identity, | 712 const std::string& identity, |
712 const std::string& certpath, | 713 const std::string& certpath, |
713 bool auto_connect) { | 714 bool auto_connect) { |
714 if (!EnsureCrosLoaded()) | 715 if (!EnsureCrosLoaded()) |
715 return; | 716 return; |
716 | 717 |
717 // First create a service from hidden network. | 718 // First create a service from hidden network. |
718 ConnectionSecurity security = password.empty() ? | |
719 SECURITY_NONE : SECURITY_UNKNOWN; | |
720 ServiceInfo* service = GetWifiService(ssid.c_str(), security); | 719 ServiceInfo* service = GetWifiService(ssid.c_str(), security); |
721 if (service) { | 720 if (service) { |
722 // Set auto-connect. | 721 // Set auto-connect. |
723 SetAutoConnect(service->service_path, auto_connect); | 722 SetAutoConnect(service->service_path, auto_connect); |
724 // Now connect to that service. | 723 // Now connect to that service. |
725 ConnectToNetworkWithCertInfo(service->service_path, | 724 ConnectToNetworkWithCertInfo(service->service_path, |
726 password.empty() ? NULL : password.c_str(), | 725 password.empty() ? NULL : password.c_str(), |
727 identity.empty() ? NULL : identity.c_str(), | 726 identity.empty() ? NULL : identity.c_str(), |
728 certpath.empty() ? NULL : certpath.c_str()); | 727 certpath.empty() ? NULL : certpath.c_str()); |
729 | 728 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 const std::string& path) { return NULL; } | 1397 const std::string& path) { return NULL; } |
1399 virtual void RequestWifiScan() {} | 1398 virtual void RequestWifiScan() {} |
1400 virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) { | 1399 virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) { |
1401 return false; | 1400 return false; |
1402 } | 1401 } |
1403 | 1402 |
1404 virtual void ConnectToWifiNetwork(const WifiNetwork* network, | 1403 virtual void ConnectToWifiNetwork(const WifiNetwork* network, |
1405 const std::string& password, | 1404 const std::string& password, |
1406 const std::string& identity, | 1405 const std::string& identity, |
1407 const std::string& certpath) {} | 1406 const std::string& certpath) {} |
1408 virtual void ConnectToWifiNetwork(const std::string& ssid, | 1407 virtual void ConnectToWifiNetwork(ConnectionSecurity security, |
| 1408 const std::string& ssid, |
1409 const std::string& password, | 1409 const std::string& password, |
1410 const std::string& identity, | 1410 const std::string& identity, |
1411 const std::string& certpath, | 1411 const std::string& certpath, |
1412 bool auto_connect) {} | 1412 bool auto_connect) {} |
1413 virtual void ConnectToCellularNetwork(const CellularNetwork* network) {} | 1413 virtual void ConnectToCellularNetwork(const CellularNetwork* network) {} |
1414 virtual void RefreshCellularDataPlans(const CellularNetwork* network) {} | 1414 virtual void RefreshCellularDataPlans(const CellularNetwork* network) {} |
1415 virtual void DisconnectFromWirelessNetwork(const WirelessNetwork* network) {} | 1415 virtual void DisconnectFromWirelessNetwork(const WirelessNetwork* network) {} |
1416 virtual void SaveCellularNetwork(const CellularNetwork* network) {} | 1416 virtual void SaveCellularNetwork(const CellularNetwork* network) {} |
1417 virtual void SaveWifiNetwork(const WifiNetwork* network) {} | 1417 virtual void SaveWifiNetwork(const WifiNetwork* network) {} |
1418 virtual void ForgetWifiNetwork(const std::string& service_path) {} | 1418 virtual void ForgetWifiNetwork(const std::string& service_path) {} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 return new NetworkLibraryStubImpl(); | 1450 return new NetworkLibraryStubImpl(); |
1451 else | 1451 else |
1452 return new NetworkLibraryImpl(); | 1452 return new NetworkLibraryImpl(); |
1453 } | 1453 } |
1454 | 1454 |
1455 } // namespace chromeos | 1455 } // namespace chromeos |
1456 | 1456 |
1457 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1457 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
1458 // won't be deleted until it's last InvokeLater is run. | 1458 // won't be deleted until it's last InvokeLater is run. |
1459 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); | 1459 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); |
OLD | NEW |