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 #include "chrome/browser/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include <dbus/dbus-glib.h> | 7 #include <dbus/dbus-glib.h> |
8 #include <dbus/dbus-gtype-specialized.h> | 8 #include <dbus/dbus-gtype-specialized.h> |
9 #include <glib-object.h> | 9 #include <glib-object.h> |
10 | 10 |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 // virtual DisconnectFromNetwork implemented in derived classes. | 1766 // virtual DisconnectFromNetwork implemented in derived classes. |
1767 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE; | 1767 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE; |
1768 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE; | 1768 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE; |
1769 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; | 1769 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; |
1770 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; | 1770 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; |
1771 // virtual EnableOfflineMode implemented in derived classes. | 1771 // virtual EnableOfflineMode implemented in derived classes. |
1772 // virtual GetIPConfigs implemented in derived classes. | 1772 // virtual GetIPConfigs implemented in derived classes. |
1773 // virtual SetIPConfig implemented in derived classes. | 1773 // virtual SetIPConfig implemented in derived classes. |
1774 virtual void SwitchToPreferredNetwork() OVERRIDE; | 1774 virtual void SwitchToPreferredNetwork() OVERRIDE; |
1775 virtual bool LoadOncNetworks(const std::string& onc_blob, | 1775 virtual bool LoadOncNetworks(const std::string& onc_blob, |
1776 const std::string& passcode, | 1776 const std::string& passphrase, |
1777 NetworkUIData::ONCSource source, | 1777 NetworkUIData::ONCSource source, |
1778 std::string* error) OVERRIDE; | 1778 std::string* error) OVERRIDE; |
1779 virtual bool SetActiveNetwork(ConnectionType type, | 1779 virtual bool SetActiveNetwork(ConnectionType type, |
1780 const std::string& service_path) OVERRIDE; | 1780 const std::string& service_path) OVERRIDE; |
1781 | 1781 |
1782 protected: | 1782 protected: |
1783 typedef ObserverList<NetworkObserver> NetworkObserverList; | 1783 typedef ObserverList<NetworkObserver> NetworkObserverList; |
1784 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; | 1784 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; |
1785 | 1785 |
1786 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; | 1786 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 if (!wifi->preferred()) // All preferred networks are sorted in front. | 2884 if (!wifi->preferred()) // All preferred networks are sorted in front. |
2885 break; | 2885 break; |
2886 if (wifi->auto_connect()) { | 2886 if (wifi->auto_connect()) { |
2887 ConnectToWifiNetwork(wifi); | 2887 ConnectToWifiNetwork(wifi); |
2888 break; | 2888 break; |
2889 } | 2889 } |
2890 } | 2890 } |
2891 } | 2891 } |
2892 | 2892 |
2893 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, | 2893 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, |
2894 const std::string& passcode, | 2894 const std::string& passphrase, |
2895 NetworkUIData::ONCSource source, | 2895 NetworkUIData::ONCSource source, |
2896 std::string* error) { | 2896 std::string* error) { |
2897 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 | 2897 OncNetworkParser parser(onc_blob, passphrase, source); |
2898 OncNetworkParser parser(onc_blob, source); | |
2899 | 2898 |
2900 if (!parser.parse_error().empty()) { | 2899 if (!parser.parse_error().empty()) { |
2901 if (error) | 2900 if (error) |
2902 *error = parser.parse_error(); | 2901 *error = parser.parse_error(); |
2903 return false; | 2902 return false; |
2904 } | 2903 } |
2905 | 2904 |
2906 for (int i = 0; i < parser.GetCertificatesSize(); i++) { | 2905 for (int i = 0; i < parser.GetCertificatesSize(); i++) { |
2907 // Insert each of the available certs into the certificate DB. | 2906 // Insert each of the available certs into the certificate DB. |
2908 if (parser.ParseCertificate(i).get() == NULL) { | 2907 if (parser.ParseCertificate(i).get() == NULL) { |
(...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5487 impl = new NetworkLibraryImplStub(); | 5486 impl = new NetworkLibraryImplStub(); |
5488 else | 5487 else |
5489 impl = new NetworkLibraryImplCros(); | 5488 impl = new NetworkLibraryImplCros(); |
5490 impl->Init(); | 5489 impl->Init(); |
5491 return impl; | 5490 return impl; |
5492 } | 5491 } |
5493 | 5492 |
5494 ///////////////////////////////////////////////////////////////////////////// | 5493 ///////////////////////////////////////////////////////////////////////////// |
5495 | 5494 |
5496 } // namespace chromeos | 5495 } // namespace chromeos |
OLD | NEW |