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

Unified Diff: chrome/browser/chromeos/cros/network_library_impl_base.cc

Issue 11299236: This moves the ONC parsing code into chromeos/network/onc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove translated strings Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/network_library_impl_base.cc
diff --git a/chrome/browser/chromeos/cros/network_library_impl_base.cc b/chrome/browser/chromeos/cros/network_library_impl_base.cc
index 89e5194b87f79d9a05fd0a09fcc83b0d4edfcd80..ec4a147bb461a6821cf56f8ff5766c7ecd429d7c 100644
--- a/chrome/browser/chromeos/cros/network_library_impl_base.cc
+++ b/chrome/browser/chromeos/cros/network_library_impl_base.cc
@@ -9,13 +9,13 @@
#include "base/memory/scoped_vector.h"
#include "base/stl_util.h"
#include "chrome/browser/chromeos/cros/native_network_parser.h"
-#include "chrome/browser/chromeos/cros/onc_constants.h"
#include "chrome/browser/chromeos/cros/onc_network_parser.h"
#include "chrome/browser/chromeos/network_login_observer.h"
-#include "chrome/browser/chromeos/network_settings/onc_certificate_importer.h"
-#include "chrome/browser/chromeos/network_settings/onc_signature.h"
-#include "chrome/browser/chromeos/network_settings/onc_utils.h"
-#include "chrome/browser/chromeos/network_settings/onc_validator.h"
+#include "chromeos/network/onc/onc_certificate_importer.h"
+#include "chromeos/network/onc/onc_constants.h"
+#include "chromeos/network/onc/onc_signature.h"
+#include "chromeos/network/onc/onc_utils.h"
+#include "chromeos/network/onc/onc_validator.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN.
#include "grit/generated_resources.h"
@@ -34,14 +34,14 @@ const int kNetworkNotifyDelayMs = 50;
// How long we should remember that cellular plan payment was received.
const int kRecentPlanPaymentHours = 6;
-NetworkProfileType GetProfileTypeForSource(NetworkUIData::ONCSource source) {
+NetworkProfileType GetProfileTypeForSource(onc::ONCSource source) {
switch (source) {
- case NetworkUIData::ONC_SOURCE_DEVICE_POLICY:
+ case onc::ONC_SOURCE_DEVICE_POLICY:
return PROFILE_SHARED;
- case NetworkUIData::ONC_SOURCE_USER_POLICY:
+ case onc::ONC_SOURCE_USER_POLICY:
return PROFILE_USER;
- case NetworkUIData::ONC_SOURCE_NONE:
- case NetworkUIData::ONC_SOURCE_USER_IMPORT:
+ case onc::ONC_SOURCE_NONE:
+ case onc::ONC_SOURCE_USER_IMPORT:
return PROFILE_NONE;
}
NOTREACHED() << "Unknown ONC source " << source;
@@ -1023,12 +1023,12 @@ void NetworkLibraryImplBase::SwitchToPreferredNetwork() {
bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
const std::string& passphrase,
- NetworkUIData::ONCSource source,
+ onc::ONCSource source,
bool allow_web_trust_from_policy,
std::string* error) {
NetworkProfile* profile = NULL;
- bool from_policy = (source == NetworkUIData::ONC_SOURCE_USER_POLICY ||
- source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY);
+ bool from_policy = (source == onc::ONC_SOURCE_USER_POLICY ||
+ source == onc::ONC_SOURCE_DEVICE_POLICY);
// Policies are applied to a specific Shill profile. User ONC import however
// is applied to whatever profile Shill chooses. This should be the profile
@@ -1105,12 +1105,9 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates";
onc::CertificateImporter cert_importer(source, allow_web_trust_from_policy);
- std::string cert_error;
- if (!cert_importer.ParseAndStoreCertificates(*certificates, &cert_error)) {
- if (error != NULL)
- *error = cert_error;
+ if (!cert_importer.ParseAndStoreCertificates(*certificates, error)) {
pneubeck (no reviews) 2012/12/04 10:43:56 same here, we shouldn't forward the error strings.
Greg Spencer (Chromium) 2012/12/07 18:12:27 Done.
LOG(WARNING) << "Cannot parse some of the certificates in the ONC from "
- << "source " << source << " with error: " << cert_error;
+ << "source " << source << " with error: " << *error;
pneubeck (no reviews) 2012/12/04 10:43:56 We don't have to log this error as it is logged al
Greg Spencer (Chromium) 2012/12/07 18:12:27 Done.
return false;
}
}
@@ -1140,7 +1137,7 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
// Disallow anything but WiFi and Ethernet for device-level policy (which
// corresponds to shared networks). See also http://crosbug.com/28741.
- if (source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY &&
+ if (source == onc::ONC_SOURCE_DEVICE_POLICY &&
network->type() != TYPE_WIFI &&
network->type() != TYPE_ETHERNET) {
LOG(WARNING) << "Ignoring device-level policy-pushed network of type "
@@ -1150,7 +1147,7 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
}
networks.push_back(network);
- if (!(source == NetworkUIData::ONC_SOURCE_USER_IMPORT &&
+ if (!(source == onc::ONC_SOURCE_USER_IMPORT &&
marked_for_removal)) {
added_onc_map[network->unique_id()] = parser.GetNetworkConfig(i);
}
@@ -1178,7 +1175,7 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
// Don't configure a network that is supposed to be removed. For
// policy-managed networks, the "remove" functionality of ONC is ignored.
- if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT &&
+ if (source == onc::ONC_SOURCE_USER_IMPORT &&
removal_ids.find(network->unique_id()) != removal_ids.end()) {
continue;
}
@@ -1222,7 +1219,7 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob,
// ONC blob. We first collect the networks and do the actual deletion later
// because ForgetNetwork() changes the remembered network vectors.
ForgetNetworksById(source, network_ids, false);
- } else if (source == NetworkUIData::ONC_SOURCE_USER_IMPORT) {
+ } else if (source == onc::ONC_SOURCE_USER_IMPORT) {
if (removal_ids.empty())
return true;
@@ -1368,7 +1365,7 @@ void NetworkLibraryImplBase::DeleteNetwork(Network* network) {
}
void NetworkLibraryImplBase::ForgetNetworksById(
- NetworkUIData::ONCSource source,
+ onc::ONCSource source,
std::set<std::string> ids,
bool if_found) {
std::vector<std::string> to_be_forgotten;
@@ -1405,9 +1402,9 @@ bool NetworkLibraryImplBase::ValidateRememberedNetwork(Network* network) {
// available to LoadOncNetworks(), which can happen due to the asynchronous
// communication between shill and NetworkLibrary. Just tell shill to
// delete the network now.
- const NetworkUIData::ONCSource source = network->ui_data().onc_source();
- if (source == NetworkUIData::ONC_SOURCE_USER_POLICY ||
- source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY) {
+ const onc::ONCSource source = network->ui_data().onc_source();
+ if (source == onc::ONC_SOURCE_USER_POLICY ||
+ source == onc::ONC_SOURCE_DEVICE_POLICY) {
NetworkSourceMap::const_iterator network_id_set(
network_source_map_.find(source));
if (network_id_set != network_source_map_.end() &&

Powered by Google App Engine
This is Rietveld 408576698