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

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: Handle "Recommended" dictionary entry properly. 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 "third_party/cros_system_api/dbus/service_constants.h" 41 #include "third_party/cros_system_api/dbus/service_constants.h"
43 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/text/bytes_formatting.h" 43 #include "ui/base/text/bytes_formatting.h"
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 // virtual DisconnectFromNetwork implemented in derived classes. 1736 // virtual DisconnectFromNetwork implemented in derived classes.
1738 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE; 1737 virtual void ForgetNetwork(const std::string& service_path) OVERRIDE;
1739 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE; 1738 virtual void EnableEthernetNetworkDevice(bool enable) OVERRIDE;
1740 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; 1739 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE;
1741 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; 1740 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE;
1742 // virtual EnableOfflineMode implemented in derived classes. 1741 // virtual EnableOfflineMode implemented in derived classes.
1743 // virtual GetIPConfigs implemented in derived classes. 1742 // virtual GetIPConfigs implemented in derived classes.
1744 // virtual SetIPConfig implemented in derived classes. 1743 // virtual SetIPConfig implemented in derived classes.
1745 virtual void SwitchToPreferredNetwork() OVERRIDE; 1744 virtual void SwitchToPreferredNetwork() OVERRIDE;
1746 virtual bool LoadOncNetworks(const std::string& onc_blob, 1745 virtual bool LoadOncNetworks(const std::string& onc_blob,
1747 const std::string& passcode) OVERRIDE; 1746 const std::string& passcode,
1747 NetworkUIData::ONCSource source) OVERRIDE;
1748 virtual bool SetActiveNetwork(ConnectionType type, 1748 virtual bool SetActiveNetwork(ConnectionType type,
1749 const std::string& service_path) OVERRIDE; 1749 const std::string& service_path) OVERRIDE;
1750 1750
1751 protected: 1751 protected:
1752 typedef ObserverList<NetworkObserver> NetworkObserverList; 1752 typedef ObserverList<NetworkObserver> NetworkObserverList;
1753 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; 1753 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap;
1754 1754
1755 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; 1755 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList;
1756 typedef std::map<std::string, NetworkDeviceObserverList*> 1756 typedef std::map<std::string, NetworkDeviceObserverList*>
1757 NetworkDeviceObserverMap; 1757 NetworkDeviceObserverMap;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 if (!wifi->preferred()) // All preferred networks are sorted in front. 2826 if (!wifi->preferred()) // All preferred networks are sorted in front.
2827 break; 2827 break;
2828 if (wifi->auto_connect()) { 2828 if (wifi->auto_connect()) {
2829 ConnectToWifiNetwork(wifi); 2829 ConnectToWifiNetwork(wifi);
2830 break; 2830 break;
2831 } 2831 }
2832 } 2832 }
2833 } 2833 }
2834 2834
2835 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, 2835 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
2836 const std::string& passcode) { 2836 const std::string& passcode,
2837 NetworkUIData::ONCSource source) {
2837 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 2838 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397
2838 OncNetworkParser parser(onc_blob); 2839 OncNetworkParser parser(onc_blob, source);
2839 2840
2840 for (int i = 0; i < parser.GetCertificatesSize(); i++) { 2841 for (int i = 0; i < parser.GetCertificatesSize(); i++) {
2841 // Insert each of the available certs into the certificate DB. 2842 // Insert each of the available certs into the certificate DB.
2842 if (!parser.ParseCertificate(i)) { 2843 if (!parser.ParseCertificate(i)) {
2843 DLOG(WARNING) << "Cannot parse certificate in ONC file"; 2844 DLOG(WARNING) << "Cannot parse certificate in ONC file";
2844 return false; 2845 return false;
2845 } 2846 }
2846 } 2847 }
2847 2848
2848 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { 2849 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) {
(...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 " \"GUID\": \"guid\"," 5094 " \"GUID\": \"guid\","
5094 " \"Type\": \"WiFi\"," 5095 " \"Type\": \"WiFi\","
5095 " \"WiFi\": {" 5096 " \"WiFi\": {"
5096 " \"Security\": \"WEP\"," 5097 " \"Security\": \"WEP\","
5097 " \"SSID\": \"MySSID\"," 5098 " \"SSID\": \"MySSID\","
5098 " }" 5099 " }"
5099 " }" 5100 " }"
5100 " ]," 5101 " ],"
5101 " \"Certificates\": []" 5102 " \"Certificates\": []"
5102 "}"); 5103 "}");
5103 LoadOncNetworks(test_blob, ""); 5104 LoadOncNetworks(test_blob, "", NetworkUIData::ONC_SOURCE_USER_IMPORT);
5104 } 5105 }
5105 5106
5106 //////////////////////////////////////////////////////////////////////////// 5107 ////////////////////////////////////////////////////////////////////////////
5107 // NetworkLibraryImplStub private methods. 5108 // NetworkLibraryImplStub private methods.
5108 5109
5109 void NetworkLibraryImplStub::AddStubNetwork( 5110 void NetworkLibraryImplStub::AddStubNetwork(
5110 Network* network, NetworkProfileType profile_type) { 5111 Network* network, NetworkProfileType profile_type) {
5111 network->priority_order_ = network_priority_order_++; 5112 network->priority_order_ = network_priority_order_++;
5112 network->CalculateUniqueId(); 5113 network->CalculateUniqueId();
5113 if (!network->unique_id().empty()) 5114 if (!network->unique_id().empty())
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 return impl; 5342 return impl;
5342 } 5343 }
5343 5344
5344 ///////////////////////////////////////////////////////////////////////////// 5345 /////////////////////////////////////////////////////////////////////////////
5345 5346
5346 } // namespace chromeos 5347 } // namespace chromeos
5347 5348
5348 // Allows InvokeLater without adding refcounting. This class is a Singleton and 5349 // Allows InvokeLater without adding refcounting. This class is a Singleton and
5349 // won't be deleted until its last InvokeLater is run. 5350 // won't be deleted until its last InvokeLater is run.
5350 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); 5351 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698