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

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

Issue 8804020: Set onc_source UI data parameter when importing ONC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 13 matching lines...) Expand all
24 #include "base/string_number_conversions.h" 24 #include "base/string_number_conversions.h"
25 #include "base/string_tokenizer.h" 25 #include "base/string_tokenizer.h"
26 #include "base/string_util.h" 26 #include "base/string_util.h"
27 #include "base/stringprintf.h" 27 #include "base/stringprintf.h"
28 #include "base/utf_string_conversion_utils.h" 28 #include "base/utf_string_conversion_utils.h"
29 #include "base/utf_string_conversions.h" 29 #include "base/utf_string_conversions.h"
30 #include "base/values.h" 30 #include "base/values.h"
31 #include "chrome/browser/chromeos/cros/cros_library.h" 31 #include "chrome/browser/chromeos/cros/cros_library.h"
32 #include "chrome/browser/chromeos/cros/native_network_constants.h" 32 #include "chrome/browser/chromeos/cros/native_network_constants.h"
33 #include "chrome/browser/chromeos/cros/native_network_parser.h" 33 #include "chrome/browser/chromeos/cros/native_network_parser.h"
34 #include "chrome/browser/chromeos/cros/network_ui_data.h"
35 #include "chrome/browser/chromeos/cros/onc_network_parser.h" 34 #include "chrome/browser/chromeos/cros/onc_network_parser.h"
36 #include "chrome/browser/chromeos/cros_settings.h" 35 #include "chrome/browser/chromeos/cros_settings.h"
37 #include "chrome/browser/chromeos/network_login_observer.h" 36 #include "chrome/browser/chromeos/network_login_observer.h"
38 #include "chrome/common/time_format.h" 37 #include "chrome/common/time_format.h"
39 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
40 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. 39 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN.
41 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
42 #include "net/base/x509_certificate.h" 41 #include "net/base/x509_certificate.h"
43 #include "third_party/cros_system_api/dbus/service_constants.h" 42 #include "third_party/cros_system_api/dbus/service_constants.h"
44 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE; 1738 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE;
1740 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE; 1739 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE;
1741 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; 1740 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE;
1742 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; 1741 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE;
1743 // virtual EnableOfflineMode implemented in derived classes. 1742 // virtual EnableOfflineMode implemented in derived classes.
1744 // virtual GetIPConfigs implemented in derived classes. 1743 // virtual GetIPConfigs implemented in derived classes.
1745 // virtual SetIPConfig implemented in derived classes. 1744 // virtual SetIPConfig implemented in derived classes.
1746 virtual void SwitchToPreferredNetwork() OVERRIDE; 1745 virtual void SwitchToPreferredNetwork() OVERRIDE;
1747 virtual bool LoadOncNetworks(const std::string& onc_blob, 1746 virtual bool LoadOncNetworks(const std::string& onc_blob,
1748 const std::string& passcode, 1747 const std::string& passcode,
1748 NetworkUIData::ONCSource source,
1749 std::string* error) OVERRIDE; 1749 std::string* error) OVERRIDE;
1750 virtual bool SetActiveNetwork(ConnectionType type, 1750 virtual bool SetActiveNetwork(ConnectionType type,
1751 const std::string& service_path) OVERRIDE; 1751 const std::string& service_path) OVERRIDE;
1752 1752
1753 protected: 1753 protected:
1754 typedef ObserverList<NetworkObserver> NetworkObserverList; 1754 typedef ObserverList<NetworkObserver> NetworkObserverList;
1755 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; 1755 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap;
1756 1756
1757 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; 1757 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList;
1758 typedef std::map<std::string, NetworkDeviceObserverList*> 1758 typedef std::map<std::string, NetworkDeviceObserverList*>
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 break; 2829 break;
2830 if (wifi->auto_connect()) { 2830 if (wifi->auto_connect()) {
2831 ConnectToWifiNetwork(wifi); 2831 ConnectToWifiNetwork(wifi);
2832 break; 2832 break;
2833 } 2833 }
2834 } 2834 }
2835 } 2835 }
2836 2836
2837 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, 2837 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
2838 const std::string& passcode, 2838 const std::string& passcode,
2839 NetworkUIData::ONCSource source,
2839 std::string* error) { 2840 std::string* error) {
2840 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 2841 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397
2841 OncNetworkParser parser(onc_blob); 2842 OncNetworkParser parser(onc_blob, source);
2842 2843
2843 if (!parser.parse_error().empty()) { 2844 if (!parser.parse_error().empty()) {
2844 if (error) 2845 if (error)
2845 *error = parser.parse_error(); 2846 *error = parser.parse_error();
2846 return false; 2847 return false;
2847 } 2848 }
2848 2849
2849 for (int i = 0; i < parser.GetCertificatesSize(); i++) { 2850 for (int i = 0; i < parser.GetCertificatesSize(); i++) {
2850 // Insert each of the available certs into the certificate DB. 2851 // Insert each of the available certs into the certificate DB.
2851 if (parser.ParseCertificate(i).get() == NULL) { 2852 if (parser.ParseCertificate(i).get() == NULL) {
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after
5114 " \"GUID\": \"guid\"," 5115 " \"GUID\": \"guid\","
5115 " \"Type\": \"WiFi\"," 5116 " \"Type\": \"WiFi\","
5116 " \"WiFi\": {" 5117 " \"WiFi\": {"
5117 " \"Security\": \"WEP\"," 5118 " \"Security\": \"WEP\","
5118 " \"SSID\": \"MySSID\"," 5119 " \"SSID\": \"MySSID\","
5119 " }" 5120 " }"
5120 " }" 5121 " }"
5121 " ]," 5122 " ],"
5122 " \"Certificates\": []" 5123 " \"Certificates\": []"
5123 "}"); 5124 "}");
5124 LoadOncNetworks(test_blob, "", NULL); 5125 LoadOncNetworks(test_blob, "", NetworkUIData::ONC_SOURCE_USER_IMPORT, NULL);
5125 } 5126 }
5126 5127
5127 //////////////////////////////////////////////////////////////////////////// 5128 ////////////////////////////////////////////////////////////////////////////
5128 // NetworkLibraryImplStub private methods. 5129 // NetworkLibraryImplStub private methods.
5129 5130
5130 void NetworkLibraryImplStub::AddStubNetwork( 5131 void NetworkLibraryImplStub::AddStubNetwork(
5131 Network* network, NetworkProfileType profile_type) { 5132 Network* network, NetworkProfileType profile_type) {
5132 network->priority_order_ = network_priority_order_++; 5133 network->priority_order_ = network_priority_order_++;
5133 network->CalculateUniqueId(); 5134 network->CalculateUniqueId();
5134 if (!network->unique_id().empty()) 5135 if (!network->unique_id().empty())
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
5362 return impl; 5363 return impl;
5363 } 5364 }
5364 5365
5365 ///////////////////////////////////////////////////////////////////////////// 5366 /////////////////////////////////////////////////////////////////////////////
5366 5367
5367 } // namespace chromeos 5368 } // namespace chromeos
5368 5369
5369 // Allows InvokeLater without adding refcounting. This class is a Singleton and 5370 // Allows InvokeLater without adding refcounting. This class is a Singleton and
5370 // won't be deleted until its last InvokeLater is run. 5371 // won't be deleted until its last InvokeLater is run.
5371 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); 5372 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.h ('k') | chrome/browser/chromeos/cros/network_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698