Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 8949056: This adds support for encrypted ONC import (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 // virtual DisconnectFromNetwork implemented in derived classes. 1757 // virtual DisconnectFromNetwork implemented in derived classes.
1758 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE; 1758 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE;
1759 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE; 1759 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE;
1760 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; 1760 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE;
1761 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; 1761 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE;
1762 // virtual EnableOfflineMode implemented in derived classes. 1762 // virtual EnableOfflineMode implemented in derived classes.
1763 // virtual GetIPConfigs implemented in derived classes. 1763 // virtual GetIPConfigs implemented in derived classes.
1764 // virtual SetIPConfig implemented in derived classes. 1764 // virtual SetIPConfig implemented in derived classes.
1765 virtual void SwitchToPreferredNetwork() OVERRIDE; 1765 virtual void SwitchToPreferredNetwork() OVERRIDE;
1766 virtual bool LoadOncNetworks(const std::string& onc_blob, 1766 virtual bool LoadOncNetworks(const std::string& onc_blob,
1767 const std::string& passcode, 1767 const std::string& passphrase,
1768 NetworkUIData::ONCSource source, 1768 NetworkUIData::ONCSource source,
1769 std::string* error) OVERRIDE; 1769 std::string* error) OVERRIDE;
1770 virtual bool SetActiveNetwork(ConnectionType type, 1770 virtual bool SetActiveNetwork(ConnectionType type,
1771 const std::string& service_path) OVERRIDE; 1771 const std::string& service_path) OVERRIDE;
1772 1772
1773 protected: 1773 protected:
1774 typedef ObserverList<NetworkObserver> NetworkObserverList; 1774 typedef ObserverList<NetworkObserver> NetworkObserverList;
1775 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; 1775 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap;
1776 1776
1777 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; 1777 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList;
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 if (!wifi->preferred()) // All preferred networks are sorted in front. 2859 if (!wifi->preferred()) // All preferred networks are sorted in front.
2860 break; 2860 break;
2861 if (wifi->auto_connect()) { 2861 if (wifi->auto_connect()) {
2862 ConnectToWifiNetwork(wifi); 2862 ConnectToWifiNetwork(wifi);
2863 break; 2863 break;
2864 } 2864 }
2865 } 2865 }
2866 } 2866 }
2867 2867
2868 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, 2868 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
2869 const std::string& passcode, 2869 const std::string& passphrase,
2870 NetworkUIData::ONCSource source, 2870 NetworkUIData::ONCSource source,
2871 std::string* error) { 2871 std::string* error) {
2872 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 2872 OncNetworkParser parser(onc_blob, passphrase, source);
2873 OncNetworkParser parser(onc_blob, source);
2874 2873
2875 if (!parser.parse_error().empty()) { 2874 if (!parser.parse_error().empty()) {
2876 if (error) 2875 if (error)
2877 *error = parser.parse_error(); 2876 *error = parser.parse_error();
2878 return false; 2877 return false;
2879 } 2878 }
2880 2879
2881 for (int i = 0; i < parser.GetCertificatesSize(); i++) { 2880 for (int i = 0; i < parser.GetCertificatesSize(); i++) {
2882 // Insert each of the available certs into the certificate DB. 2881 // Insert each of the available certs into the certificate DB.
2883 if (parser.ParseCertificate(i).get() == NULL) { 2882 if (parser.ParseCertificate(i).get() == NULL) {
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
5455 impl = new NetworkLibraryImplStub(); 5454 impl = new NetworkLibraryImplStub();
5456 else 5455 else
5457 impl = new NetworkLibraryImplCros(); 5456 impl = new NetworkLibraryImplCros();
5458 impl->Init(); 5457 impl->Init();
5459 return impl; 5458 return impl;
5460 } 5459 }
5461 5460
5462 ///////////////////////////////////////////////////////////////////////////// 5461 /////////////////////////////////////////////////////////////////////////////
5463 5462
5464 } // namespace chromeos 5463 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698