summaryrefslogtreecommitdiffstats
path: root/chromeos/network
diff options
context:
space:
mode:
Diffstat (limited to 'chromeos/network')
-rw-r--r--chromeos/network/DEPS1
-rw-r--r--chromeos/network/certificate_pattern.cc2
-rw-r--r--chromeos/network/client_cert_resolver.cc8
-rw-r--r--chromeos/network/favorite_state.h2
-rw-r--r--chromeos/network/managed_network_configuration_handler.h6
-rw-r--r--chromeos/network/managed_network_configuration_handler_impl.cc22
-rw-r--r--chromeos/network/managed_network_configuration_handler_unittest.cc34
-rw-r--r--chromeos/network/mock_managed_network_configuration_handler.h9
-rw-r--r--chromeos/network/network_state.h2
-rw-r--r--chromeos/network/network_ui_data.cc22
-rw-r--r--chromeos/network/network_ui_data.h14
-rw-r--r--chromeos/network/network_ui_data_unittest.cc8
-rw-r--r--chromeos/network/onc/mock_certificate_importer.h2
-rw-r--r--chromeos/network/onc/onc_certificate_importer.h4
-rw-r--r--chromeos/network/onc/onc_certificate_importer_impl.cc33
-rw-r--r--chromeos/network/onc/onc_certificate_importer_impl.h4
-rw-r--r--chromeos/network/onc/onc_certificate_importer_impl_unittest.cc6
-rw-r--r--chromeos/network/onc/onc_constants.cc295
-rw-r--r--chromeos/network/onc/onc_constants.h317
-rw-r--r--chromeos/network/onc/onc_merger.cc48
-rw-r--r--chromeos/network/onc/onc_merger_unittest.cc2
-rw-r--r--chromeos/network/onc/onc_normalizer.cc98
-rw-r--r--chromeos/network/onc/onc_signature.cc454
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc311
-rw-r--r--chromeos/network/onc/onc_translator_onc_to_shill.cc41
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc53
-rw-r--r--chromeos/network/onc/onc_translator_unittest.cc2
-rw-r--r--chromeos/network/onc/onc_utils.cc2
-rw-r--r--chromeos/network/onc/onc_utils.h6
-rw-r--r--chromeos/network/onc/onc_utils_unittest.cc4
-rw-r--r--chromeos/network/onc/onc_validator.cc134
-rw-r--r--chromeos/network/onc/onc_validator.h6
-rw-r--r--chromeos/network/onc/onc_validator_unittest.cc20
-rw-r--r--chromeos/network/policy_applicator.cc21
-rw-r--r--chromeos/network/policy_util.cc43
35 files changed, 708 insertions, 1328 deletions
diff --git a/chromeos/network/DEPS b/chromeos/network/DEPS
index d6abdda..bc366f1 100644
--- a/chromeos/network/DEPS
+++ b/chromeos/network/DEPS
@@ -1,3 +1,4 @@
include_rules = [
"+dbus",
+ "+components/onc",
]
diff --git a/chromeos/network/certificate_pattern.cc b/chromeos/network/certificate_pattern.cc
index 63c9c19..df8c241 100644
--- a/chromeos/network/certificate_pattern.cc
+++ b/chromeos/network/certificate_pattern.cc
@@ -6,7 +6,7 @@
#include "base/logging.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
diff --git a/chromeos/network/client_cert_resolver.cc b/chromeos/network/client_cert_resolver.cc
index 998f75a..72c97c5 100644
--- a/chromeos/network/client_cert_resolver.cc
+++ b/chromeos/network/client_cert_resolver.cc
@@ -24,7 +24,7 @@
#include "chromeos/network/managed_network_configuration_handler.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "dbus/object_path.h"
#include "net/cert/x509_certificate.h"
@@ -100,7 +100,7 @@ struct NetworkAndCertPattern {
// A unary predicate that returns true if the given CertAndIssuer matches the
// certificate pattern of the NetworkAndCertPattern.
struct MatchCertWithPattern {
- MatchCertWithPattern(const NetworkAndCertPattern& pattern)
+ explicit MatchCertWithPattern(const NetworkAndCertPattern& pattern)
: net_and_pattern(pattern) {}
bool operator()(const CertAndIssuer& cert_and_issuer) {
@@ -192,7 +192,7 @@ void FindCertificateMatches(const net::CertificateList& certs,
// pattern within an EAP, IPsec or OpenVPN configuration.
client_cert::ConfigType OncToClientCertConfigurationType(
const base::DictionaryValue& network_config) {
- using namespace ::chromeos::onc;
+ using namespace ::onc;
const base::DictionaryValue* wifi = NULL;
network_config.GetDictionaryWithoutPathExpansion(network_config::kWiFi,
@@ -247,7 +247,7 @@ void LogError(const std::string& service_path,
}
bool ClientCertificatesLoaded() {
- if(!CertLoader::Get()->certificates_loaded()) {
+ if (!CertLoader::Get()->certificates_loaded()) {
VLOG(1) << "Certificates not loaded yet.";
return false;
}
diff --git a/chromeos/network/favorite_state.h b/chromeos/network/favorite_state.h
index 9fbe3ea..dbce3c0 100644
--- a/chromeos/network/favorite_state.h
+++ b/chromeos/network/favorite_state.h
@@ -10,7 +10,7 @@
#include "base/values.h"
#include "chromeos/network/managed_state.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
diff --git a/chromeos/network/managed_network_configuration_handler.h b/chromeos/network/managed_network_configuration_handler.h
index d57c76f..39107f8 100644
--- a/chromeos/network/managed_network_configuration_handler.h
+++ b/chromeos/network/managed_network_configuration_handler.h
@@ -14,7 +14,7 @@
#include "chromeos/chromeos_export.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_handler_callbacks.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -107,7 +107,7 @@ class CHROMEOS_EXPORT ManagedNetworkConfigurationHandler {
// to Shill's profiles and enforced in future configurations until the policy
// associated with |onc_source| is changed again with this function. For
// device policies, |userhash| must be empty.
- virtual void SetPolicy(onc::ONCSource onc_source,
+ virtual void SetPolicy(::onc::ONCSource onc_source,
const std::string& userhash,
const base::ListValue& network_configs_onc) = 0;
@@ -117,7 +117,7 @@ class CHROMEOS_EXPORT ManagedNetworkConfigurationHandler {
virtual const base::DictionaryValue* FindPolicyByGUID(
const std::string userhash,
const std::string& guid,
- onc::ONCSource* onc_source) const = 0;
+ ::onc::ONCSource* onc_source) const = 0;
// Returns the policy with |guid| for profile |profile_path|. If such
// doesn't exist, returns NULL.
diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc
index f6c8414..647568e 100644
--- a/chromeos/network/managed_network_configuration_handler_impl.cc
+++ b/chromeos/network/managed_network_configuration_handler_impl.cc
@@ -26,13 +26,13 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_merger.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translator.h"
#include "chromeos/network/onc/onc_validator.h"
#include "chromeos/network/policy_util.h"
#include "chromeos/network/shill_property_util.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -58,9 +58,9 @@ const char kUnknownProfilePath[] = "Error.UnknownProfilePath";
const char kUnknownServicePathMessage[] = "Service path is unknown.";
const char kUnknownServicePath[] = "Error.UnknownServicePath";
-std::string ToDebugString(onc::ONCSource source,
+std::string ToDebugString(::onc::ONCSource source,
const std::string& userhash) {
- return source == onc::ONC_SOURCE_USER_POLICY ?
+ return source == ::onc::ONC_SOURCE_USER_POLICY ?
("user policy of " + userhash) : "device policy";
}
@@ -180,7 +180,7 @@ void ManagedNetworkConfigurationHandlerImpl::GetManagedPropertiesCallback(
&onc::kNetworkWithStateSignature));
std::string guid;
- active_settings->GetStringWithoutPathExpansion(onc::network_config::kGUID,
+ active_settings->GetStringWithoutPathExpansion(::onc::network_config::kGUID,
&guid);
const base::DictionaryValue* user_policy = NULL;
@@ -365,14 +365,14 @@ void ManagedNetworkConfigurationHandlerImpl::RemoveConfiguration(
}
void ManagedNetworkConfigurationHandlerImpl::SetPolicy(
- onc::ONCSource onc_source,
+ ::onc::ONCSource onc_source,
const std::string& userhash,
const base::ListValue& network_configs_onc) {
VLOG(1) << "Setting policies from " << ToDebugString(onc_source, userhash)
<< ".";
// |userhash| must be empty for device policies.
- DCHECK(onc_source != chromeos::onc::ONC_SOURCE_DEVICE_POLICY ||
+ DCHECK(onc_source != ::onc::ONC_SOURCE_DEVICE_POLICY ||
userhash.empty());
GuidToPolicyMap& policies = policies_by_user_[userhash];
@@ -389,7 +389,7 @@ void ManagedNetworkConfigurationHandlerImpl::SetPolicy(
DCHECK(network);
std::string guid;
- network->GetStringWithoutPathExpansion(onc::network_config::kGUID, &guid);
+ network->GetStringWithoutPathExpansion(::onc::network_config::kGUID, &guid);
DCHECK(!guid.empty());
if (policies.count(guid) > 0) {
@@ -461,15 +461,15 @@ const base::DictionaryValue*
ManagedNetworkConfigurationHandlerImpl::FindPolicyByGUID(
const std::string userhash,
const std::string& guid,
- onc::ONCSource* onc_source) const {
- *onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource* onc_source) const {
+ *onc_source = ::onc::ONC_SOURCE_NONE;
if (!userhash.empty()) {
const GuidToPolicyMap* user_policies = GetPoliciesForUser(userhash);
if (user_policies) {
GuidToPolicyMap::const_iterator found = user_policies->find(guid);
if (found != user_policies->end()) {
- *onc_source = onc::ONC_SOURCE_USER_POLICY;
+ *onc_source = ::onc::ONC_SOURCE_USER_POLICY;
return found->second;
}
}
@@ -479,7 +479,7 @@ ManagedNetworkConfigurationHandlerImpl::FindPolicyByGUID(
if (device_policies) {
GuidToPolicyMap::const_iterator found = device_policies->find(guid);
if (found != device_policies->end()) {
- *onc_source = onc::ONC_SOURCE_DEVICE_POLICY;
+ *onc_source = ::onc::ONC_SOURCE_DEVICE_POLICY;
return found->second;
}
}
diff --git a/chromeos/network/managed_network_configuration_handler_unittest.cc b/chromeos/network/managed_network_configuration_handler_unittest.cc
index ef76586..1a91686 100644
--- a/chromeos/network/managed_network_configuration_handler_unittest.cc
+++ b/chromeos/network/managed_network_configuration_handler_unittest.cc
@@ -220,7 +220,7 @@ class ManagedNetworkConfigurationHandlerTest : public testing::Test {
profiles_stub_.AddEntry(profile_path, entry_path, *entry);
}
- void SetPolicy(onc::ONCSource onc_source,
+ void SetPolicy(::onc::ONCSource onc_source,
const std::string& userhash,
const std::string& path_to_onc) {
scoped_ptr<base::DictionaryValue> policy;
@@ -231,10 +231,10 @@ class ManagedNetworkConfigurationHandlerTest : public testing::Test {
base::ListValue* network_configs = NULL;
policy->GetListWithoutPathExpansion(
- onc::toplevel_config::kNetworkConfigurations, &network_configs);
+ ::onc::toplevel_config::kNetworkConfigurations, &network_configs);
managed_handler()->SetPolicy(
- onc::ONC_SOURCE_USER_POLICY, userhash, *network_configs);
+ ::onc::ONC_SOURCE_USER_POLICY, userhash, *network_configs);
}
void SetNetworkConfigurationHandlerExpectations() {
@@ -285,7 +285,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, RemoveIrrelevantFields) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY,
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY,
kUser1,
"policy/policy_wifi1_with_redundant_fields.onc");
message_loop_.RunUntilIdle();
@@ -306,7 +306,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnconfigured) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -347,7 +347,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest,
_, _));
SetPolicy(
- onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_ethernet_eap.onc");
+ ::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_ethernet_eap.onc");
message_loop_.RunUntilIdle();
}
@@ -357,7 +357,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) {
EXPECT_CALL(mock_manager_client_, ConfigureServiceForProfile(_, _, _, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
VerifyAndClearExpectations();
@@ -371,7 +371,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) {
mock_profile_client_,
GetEntry(dbus::ObjectPath(kUser1ProfilePath), "some_entry_path", _, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -402,7 +402,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnmanaged) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -435,7 +435,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest,
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -471,7 +471,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyUpdateManagedNewGUID) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -503,7 +503,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyReapplyToManaged) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
VerifyAndClearExpectations();
@@ -516,7 +516,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyReapplyToManaged) {
mock_profile_client_,
GetEntry(dbus::ObjectPath(kUser1ProfilePath), "old_entry_path", _, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
@@ -539,7 +539,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyUnmanageManaged) {
"old_entry_path",
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "");
message_loop_.RunUntilIdle();
}
@@ -557,7 +557,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetEmptyPolicyIgnoreUnmanaged) {
"old_entry_path",
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "");
message_loop_.RunUntilIdle();
}
@@ -584,12 +584,12 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmanaged) {
IsEqualTo(expected_shill_properties.get()),
_, _));
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
}
TEST_F(ManagedNetworkConfigurationHandlerTest, LateProfileLoading) {
- SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
+ SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
message_loop_.RunUntilIdle();
VerifyAndClearExpectations();
diff --git a/chromeos/network/mock_managed_network_configuration_handler.h b/chromeos/network/mock_managed_network_configuration_handler.h
index 0c377b9..e8dd9e9 100644
--- a/chromeos/network/mock_managed_network_configuration_handler.h
+++ b/chromeos/network/mock_managed_network_configuration_handler.h
@@ -50,13 +50,14 @@ class CHROMEOS_EXPORT MockManagedNetworkConfigurationHandler
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_METHOD3(SetPolicy,
- void(onc::ONCSource onc_source,
+ void(::onc::ONCSource onc_source,
const std::string& userhash,
const base::ListValue& network_configs_onc));
MOCK_CONST_METHOD3(FindPolicyByGUID,
- const base::DictionaryValue*(const std::string userhash,
- const std::string& guid,
- onc::ONCSource* onc_source));
+ const base::DictionaryValue*(
+ const std::string userhash,
+ const std::string& guid,
+ ::onc::ONCSource* onc_source));
MOCK_CONST_METHOD2(
FindPolicyByGuidAndProfile,
const base::DictionaryValue*(const std::string& guid,
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index b736a2b..390da44 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -10,7 +10,7 @@
#include "chromeos/network/managed_state.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "url/gurl.h"
namespace base {
diff --git a/chromeos/network/network_ui_data.cc b/chromeos/network/network_ui_data.cc
index 2190e86..65ac5f3 100644
--- a/chromeos/network/network_ui_data.cc
+++ b/chromeos/network/network_ui_data.cc
@@ -24,10 +24,10 @@ struct StringEnumEntry {
Enum enum_value;
};
-const StringEnumEntry<onc::ONCSource> kONCSourceTable[] = {
- { "user_import", onc::ONC_SOURCE_USER_IMPORT },
- { "device_policy", onc::ONC_SOURCE_DEVICE_POLICY },
- { "user_policy", onc::ONC_SOURCE_USER_POLICY }
+const StringEnumEntry< ::onc::ONCSource> kONCSourceTable[] = {
+ { "user_import", ::onc::ONC_SOURCE_USER_IMPORT },
+ { "device_policy", ::onc::ONC_SOURCE_DEVICE_POLICY },
+ { "user_policy", ::onc::ONC_SOURCE_USER_POLICY }
};
const StringEnumEntry<ClientCertType> kClientCertTable[] = {
@@ -65,7 +65,7 @@ Enum StringToEnum(const StringEnumEntry<Enum>(& table)[N],
} // namespace
NetworkUIData::NetworkUIData()
- : onc_source_(onc::ONC_SOURCE_NONE),
+ : onc_source_(::onc::ONC_SOURCE_NONE),
certificate_type_(CLIENT_CERT_TYPE_NONE) {
}
@@ -86,7 +86,7 @@ NetworkUIData& NetworkUIData::operator=(const NetworkUIData& other) {
NetworkUIData::NetworkUIData(const base::DictionaryValue& dict) {
std::string source;
dict.GetString(kKeyONCSource, &source);
- onc_source_ = StringToEnum(kONCSourceTable, source, onc::ONC_SOURCE_NONE);
+ onc_source_ = StringToEnum(kONCSourceTable, source, ::onc::ONC_SOURCE_NONE);
std::string type_string;
dict.GetString(kKeyCertificateType, &type_string);
@@ -143,7 +143,7 @@ namespace {
void TranslateClientCertType(const std::string& client_cert_type,
NetworkUIData* ui_data) {
- using namespace onc::certificate;
+ using namespace ::onc::certificate;
ClientCertType type;
if (client_cert_type == kNone) {
type = CLIENT_CERT_TYPE_NONE;
@@ -170,7 +170,7 @@ void TranslateCertificatePattern(const base::DictionaryValue& onc_object,
void TranslateEAP(const base::DictionaryValue& eap,
NetworkUIData* ui_data) {
std::string client_cert_type;
- if (eap.GetStringWithoutPathExpansion(onc::eap::kClientCertType,
+ if (eap.GetStringWithoutPathExpansion(::onc::eap::kClientCertType,
&client_cert_type)) {
TranslateClientCertType(client_cert_type, ui_data);
}
@@ -179,7 +179,7 @@ void TranslateEAP(const base::DictionaryValue& eap,
void TranslateIPsec(const base::DictionaryValue& ipsec,
NetworkUIData* ui_data) {
std::string client_cert_type;
- if (ipsec.GetStringWithoutPathExpansion(onc::vpn::kClientCertType,
+ if (ipsec.GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
&client_cert_type)) {
TranslateClientCertType(client_cert_type, ui_data);
}
@@ -188,7 +188,7 @@ void TranslateIPsec(const base::DictionaryValue& ipsec,
void TranslateOpenVPN(const base::DictionaryValue& openvpn,
NetworkUIData* ui_data) {
std::string client_cert_type;
- if (openvpn.GetStringWithoutPathExpansion(onc::vpn::kClientCertType,
+ if (openvpn.GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
&client_cert_type)) {
TranslateClientCertType(client_cert_type, ui_data);
}
@@ -225,7 +225,7 @@ void TranslateONCHierarchy(const onc::OncValueSignature& signature,
// static
scoped_ptr<NetworkUIData> NetworkUIData::CreateFromONC(
- onc::ONCSource onc_source,
+ ::onc::ONCSource onc_source,
const base::DictionaryValue& onc_network) {
scoped_ptr<NetworkUIData> ui_data(new NetworkUIData());
TranslateONCHierarchy(onc::kNetworkConfigurationSignature, onc_network,
diff --git a/chromeos/network/network_ui_data.h b/chromeos/network/network_ui_data.h
index dd9d40a..92595ee 100644
--- a/chromeos/network/network_ui_data.h
+++ b/chromeos/network/network_ui_data.h
@@ -11,7 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/certificate_pattern.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -42,8 +42,8 @@ class CHROMEOS_EXPORT NetworkUIData {
explicit NetworkUIData(const base::DictionaryValue& dict);
~NetworkUIData();
- void set_onc_source(onc::ONCSource onc_source) { onc_source_ = onc_source; }
- onc::ONCSource onc_source() const { return onc_source_; }
+ void set_onc_source(::onc::ONCSource onc_source) { onc_source_ = onc_source; }
+ ::onc::ONCSource onc_source() const { return onc_source_; }
void set_certificate_pattern(const CertificatePattern& pattern) {
certificate_pattern_ = pattern;
@@ -58,8 +58,8 @@ class CHROMEOS_EXPORT NetworkUIData {
return certificate_type_;
}
bool is_managed() const {
- return onc_source_ == onc::ONC_SOURCE_DEVICE_POLICY ||
- onc_source_ == onc::ONC_SOURCE_USER_POLICY;
+ return onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY ||
+ onc_source_ == ::onc::ONC_SOURCE_USER_POLICY;
}
const base::DictionaryValue* user_settings() const {
return user_settings_.get();
@@ -81,7 +81,7 @@ class CHROMEOS_EXPORT NetworkUIData {
// This function is used to create the "UIData" field of the Shill
// configuration.
static scoped_ptr<NetworkUIData> CreateFromONC(
- onc::ONCSource onc_source,
+ ::onc::ONCSource onc_source,
const base::DictionaryValue& onc_network);
// Key for storing source of the ONC network.
@@ -98,7 +98,7 @@ class CHROMEOS_EXPORT NetworkUIData {
private:
CertificatePattern certificate_pattern_;
- onc::ONCSource onc_source_;
+ ::onc::ONCSource onc_source_;
ClientCertType certificate_type_;
scoped_ptr<base::DictionaryValue> user_settings_;
std::string policy_guid_;
diff --git a/chromeos/network/network_ui_data_unittest.cc b/chromeos/network/network_ui_data_unittest.cc
index 857218b8..ff07b0c 100644
--- a/chromeos/network/network_ui_data_unittest.cc
+++ b/chromeos/network/network_ui_data_unittest.cc
@@ -16,20 +16,20 @@ TEST(NetworkUIDataTest, ONCSource) {
ui_data_dict.SetString(NetworkUIData::kKeyONCSource, "user_import");
{
NetworkUIData ui_data(ui_data_dict);
- EXPECT_EQ(onc::ONC_SOURCE_USER_IMPORT, ui_data.onc_source());
+ EXPECT_EQ(::onc::ONC_SOURCE_USER_IMPORT, ui_data.onc_source());
EXPECT_FALSE(ui_data.is_managed());
}
ui_data_dict.SetString(NetworkUIData::kKeyONCSource, "device_policy");
{
NetworkUIData ui_data(ui_data_dict);
- EXPECT_EQ(onc::ONC_SOURCE_DEVICE_POLICY, ui_data.onc_source());
+ EXPECT_EQ(::onc::ONC_SOURCE_DEVICE_POLICY, ui_data.onc_source());
EXPECT_TRUE(ui_data.is_managed());
}
ui_data_dict.SetString(NetworkUIData::kKeyONCSource, "user_policy");
{
NetworkUIData ui_data(ui_data_dict);
- EXPECT_EQ(onc::ONC_SOURCE_USER_POLICY, ui_data.onc_source());
+ EXPECT_EQ(::onc::ONC_SOURCE_USER_POLICY, ui_data.onc_source());
EXPECT_TRUE(ui_data.is_managed());
}
}
@@ -91,7 +91,7 @@ TEST_P(CreateUIDataTest, CreateUIDataFromONC) {
scoped_ptr<NetworkUIData> actual_uidata =
NetworkUIData::CreateFromONC(
- onc::ONC_SOURCE_USER_POLICY, *onc_network);
+ ::onc::ONC_SOURCE_USER_POLICY, *onc_network);
EXPECT_TRUE(actual_uidata != NULL);
base::DictionaryValue actual_uidata_dict;
diff --git a/chromeos/network/onc/mock_certificate_importer.h b/chromeos/network/onc/mock_certificate_importer.h
index fc3544f..723cd9d 100644
--- a/chromeos/network/onc/mock_certificate_importer.h
+++ b/chromeos/network/onc/mock_certificate_importer.h
@@ -19,7 +19,7 @@ class CHROMEOS_EXPORT MockCertificateImporter : public CertificateImporter {
MockCertificateImporter();
virtual ~MockCertificateImporter();
MOCK_METHOD3(ImportCertificates, bool(const base::ListValue&,
- onc::ONCSource,
+ ::onc::ONCSource,
net::CertificateList*));
private:
DISALLOW_COPY_AND_ASSIGN(MockCertificateImporter);
diff --git a/chromeos/network/onc/onc_certificate_importer.h b/chromeos/network/onc/onc_certificate_importer.h
index 32e901e..c691f74 100644
--- a/chromeos/network/onc/onc_certificate_importer.h
+++ b/chromeos/network/onc/onc_certificate_importer.h
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "chromeos/chromeos_export.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "net/cert/x509_certificate.h"
namespace base {
@@ -31,7 +31,7 @@ class CHROMEOS_EXPORT CertificateImporter {
// successfully.
virtual bool ImportCertificates(
const base::ListValue& certificates,
- onc::ONCSource source,
+ ::onc::ONCSource source,
net::CertificateList* onc_trusted_certificates) = 0;
private:
diff --git a/chromeos/network/onc/onc_certificate_importer_impl.cc b/chromeos/network/onc/onc_certificate_importer_impl.cc
index c21a5ae..4f55838 100644
--- a/chromeos/network/onc/onc_certificate_importer_impl.cc
+++ b/chromeos/network/onc/onc_certificate_importer_impl.cc
@@ -12,8 +12,8 @@
#include "base/logging.h"
#include "base/values.h"
#include "chromeos/network/network_event_log.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "components/onc/onc_constants.h"
#include "net/base/crypto_module.h"
#include "net/base/net_errors.h"
#include "net/cert/nss_cert_database.h"
@@ -32,12 +32,12 @@ CertificateImporterImpl::CertificateImporterImpl() {
bool CertificateImporterImpl::ImportCertificates(
const base::ListValue& certificates,
- onc::ONCSource source,
+ ::onc::ONCSource source,
net::CertificateList* onc_trusted_certificates) {
VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates";
// Web trust is only granted to certificates imported by the user.
- bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT;
+ bool allow_trust_imports = source == ::onc::ONC_SOURCE_USER_IMPORT;
if (!ParseAndStoreCertificates(
allow_trust_imports, certificates, onc_trusted_certificates, NULL)) {
LOG(ERROR) << "Cannot parse some of the certificates in the ONC from "
@@ -140,11 +140,12 @@ bool CertificateImporterImpl::ParseAndStoreCertificate(
CertsByGUID* imported_server_and_ca_certs) {
// Get out the attributes of the given certificate.
std::string guid;
- certificate.GetStringWithoutPathExpansion(certificate::kGUID, &guid);
+ certificate.GetStringWithoutPathExpansion(::onc::certificate::kGUID, &guid);
DCHECK(!guid.empty());
bool remove = false;
- if (certificate.GetBooleanWithoutPathExpansion(kRemove, &remove) && remove) {
+ if (certificate.GetBooleanWithoutPathExpansion(::onc::kRemove, &remove) &&
+ remove) {
if (!DeleteCertAndKeyByNickname(guid)) {
ONC_LOG_ERROR("Unable to delete certificate");
return false;
@@ -155,16 +156,17 @@ bool CertificateImporterImpl::ParseAndStoreCertificate(
// Not removing, so let's get the data we need to add this certificate.
std::string cert_type;
- certificate.GetStringWithoutPathExpansion(certificate::kType, &cert_type);
- if (cert_type == certificate::kServer ||
- cert_type == certificate::kAuthority) {
+ certificate.GetStringWithoutPathExpansion(::onc::certificate::kType,
+ &cert_type);
+ if (cert_type == ::onc::certificate::kServer ||
+ cert_type == ::onc::certificate::kAuthority) {
return ParseServerOrCaCertificate(allow_trust_imports,
cert_type,
guid,
certificate,
onc_trusted_certificates,
imported_server_and_ca_certs);
- } else if (cert_type == certificate::kClient) {
+ } else if (cert_type == ::onc::certificate::kClient) {
return ParseClientCertificate(guid, certificate);
}
@@ -181,7 +183,7 @@ bool CertificateImporterImpl::ParseServerOrCaCertificate(
CertsByGUID* imported_server_and_ca_certs) {
bool web_trust_flag = false;
const base::ListValue* trust_list = NULL;
- if (certificate.GetListWithoutPathExpansion(certificate::kTrustBits,
+ if (certificate.GetListWithoutPathExpansion(::onc::certificate::kTrustBits,
&trust_list)) {
for (base::ListValue::const_iterator it = trust_list->begin();
it != trust_list->end(); ++it) {
@@ -189,7 +191,7 @@ bool CertificateImporterImpl::ParseServerOrCaCertificate(
if (!(*it)->GetAsString(&trust_type))
NOTREACHED();
- if (trust_type == certificate::kWeb) {
+ if (trust_type == ::onc::certificate::kWeb) {
// "Web" implies that the certificate is to be trusted for SSL
// identification.
web_trust_flag = true;
@@ -211,7 +213,7 @@ bool CertificateImporterImpl::ParseServerOrCaCertificate(
}
std::string x509_data;
- if (!certificate.GetStringWithoutPathExpansion(certificate::kX509,
+ if (!certificate.GetStringWithoutPathExpansion(::onc::certificate::kX509,
&x509_data) ||
x509_data.empty()) {
ONC_LOG_ERROR(
@@ -235,7 +237,8 @@ bool CertificateImporterImpl::ParseServerOrCaCertificate(
net::NSSCertDatabase* cert_database = net::NSSCertDatabase::GetInstance();
if (x509_cert->os_cert_handle()->isperm) {
net::CertType net_cert_type =
- cert_type == certificate::kServer ? net::SERVER_CERT : net::CA_CERT;
+ cert_type == ::onc::certificate::kServer ? net::SERVER_CERT
+ : net::CA_CERT;
VLOG(1) << "Certificate is already installed.";
net::NSSCertDatabase::TrustBits missing_trust_bits =
trust & ~cert_database->GetCertTrust(x509_cert.get(), net_cert_type);
@@ -260,7 +263,7 @@ bool CertificateImporterImpl::ParseServerOrCaCertificate(
cert_list.push_back(x509_cert);
net::NSSCertDatabase::ImportCertFailureList failures;
bool success = false;
- if (cert_type == certificate::kServer)
+ if (cert_type == ::onc::certificate::kServer)
success = cert_database->ImportServerCert(cert_list, trust, &failures);
else // Authority cert
success = cert_database->ImportCACerts(cert_list, trust, &failures);
@@ -292,7 +295,7 @@ bool CertificateImporterImpl::ParseClientCertificate(
const std::string& guid,
const base::DictionaryValue& certificate) {
std::string pkcs12_data;
- if (!certificate.GetStringWithoutPathExpansion(certificate::kPKCS12,
+ if (!certificate.GetStringWithoutPathExpansion(::onc::certificate::kPKCS12,
&pkcs12_data) ||
pkcs12_data.empty()) {
ONC_LOG_ERROR("PKCS12 data is missing for client certificate.");
diff --git a/chromeos/network/onc/onc_certificate_importer_impl.h b/chromeos/network/onc/onc_certificate_importer_impl.h
index 87fea6c..82db305 100644
--- a/chromeos/network/onc/onc_certificate_importer_impl.h
+++ b/chromeos/network/onc/onc_certificate_importer_impl.h
@@ -14,7 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/onc/onc_certificate_importer.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -45,7 +45,7 @@ class CHROMEOS_EXPORT CertificateImporterImpl : public CertificateImporter {
// CertificateImporter overrides
virtual bool ImportCertificates(
const base::ListValue& certificates,
- onc::ONCSource source,
+ ::onc::ONCSource source,
net::CertificateList* onc_trusted_certificates) OVERRIDE;
// This implements ImportCertificates. Additionally, if
diff --git a/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc b/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
index b293a98..9fa39e0 100644
--- a/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
+++ b/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
@@ -13,8 +13,8 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_test_utils.h"
+#include "components/onc/onc_constants.h"
#include "crypto/nss_util.h"
#include "net/base/crypto_module.h"
#include "net/cert/cert_type.h"
@@ -82,7 +82,7 @@ class ONCCertificateImporterImplTest : public testing::Test {
test_utils::ReadTestDictionary(filename);
scoped_ptr<base::Value> certificates_value;
base::ListValue* certificates = NULL;
- onc->RemoveWithoutPathExpansion(toplevel_config::kCertificates,
+ onc->RemoveWithoutPathExpansion(::onc::toplevel_config::kCertificates,
&certificates_value);
certificates_value.release()->GetAsList(&certificates);
onc_certificates_.reset(certificates);
@@ -114,7 +114,7 @@ class ONCCertificateImporterImplTest : public testing::Test {
base::DictionaryValue* certificate = NULL;
onc_certificates_->GetDictionary(0, &certificate);
- certificate->GetStringWithoutPathExpansion(certificate::kGUID, guid);
+ certificate->GetStringWithoutPathExpansion(::onc::certificate::kGUID, guid);
if (expected_type == net::SERVER_CERT || expected_type == net::CA_CERT) {
EXPECT_EQ(1u, imported_server_and_ca_certs_.size());
diff --git a/chromeos/network/onc/onc_constants.cc b/chromeos/network/onc/onc_constants.cc
deleted file mode 100644
index 1214dfe..0000000
--- a/chromeos/network/onc/onc_constants.cc
+++ /dev/null
@@ -1,295 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/network/onc/onc_constants.h"
-
-namespace chromeos {
-
-// Constants for ONC properties.
-namespace onc {
-
-const char kAugmentationActiveSetting[] = "Active";
-const char kAugmentationEffectiveSetting[] = "Effective";
-const char kAugmentationUnmanaged[] = "Unmanaged";
-const char kAugmentationUserPolicy[] = "UserPolicy";
-const char kAugmentationDevicePolicy[] = "DevicePolicy";
-const char kAugmentationUserSetting[] = "UserSetting";
-const char kAugmentationSharedSetting[] = "SharedSetting";
-const char kAugmentationUserEditable[] = "UserEditable";
-const char kAugmentationDeviceEditable[] = "DeviceEditable";
-
-// Common keys/values.
-const char kRecommended[] = "Recommended";
-const char kRemove[] = "Remove";
-
-// Top Level Configuration
-namespace toplevel_config {
-const char kCertificates[] = "Certificates";
-const char kEncryptedConfiguration[] = "EncryptedConfiguration";
-const char kNetworkConfigurations[] = "NetworkConfigurations";
-const char kType[] = "Type";
-const char kUnencryptedConfiguration[] = "UnencryptedConfiguration";
-} // namespace toplevel_config
-
-// Network Configuration
-namespace network_config {
-const char kCellular[] = "Cellular";
-const char kEthernet[] = "Ethernet";
-const char kGUID[] = "GUID";
-const char kIPConfigs[] = "IPConfigs";
-const char kName[] = "Name";
-const char kNameServers[] = "NameServers";
-const char kProxySettings[] = "ProxySettings";
-const char kSearchDomains[] = "SearchDomains";
-const char kServicePath[] = "ServicePath";
-const char kConnectionState[] = "ConnectionState";
-const char kType[] = "Type";
-const char kVPN[] = "VPN";
-const char kWiFi[] = "WiFi";
-} // namespace network_config
-
-namespace network_type {
-const char kAllTypes[] = "All";
-const char kCellular[] = "Cellular";
-const char kEthernet[] = "Ethernet";
-const char kVPN[] = "VPN";
-const char kWiFi[] = "WiFi";
-} // namespace network_type
-
-namespace cellular {
-const char kActivateOverNonCellularNetwork[] = "ActivateOverNonCellularNetwork";
-const char kActivationState[] = "ActivationState";
-const char kAllowRoaming[] = "AllowRoaming";
-const char kAPN[] = "APN";
-const char kCarrier[] = "Carrier";
-const char kESN[] = "ESN";
-const char kFamily[] = "Family";
-const char kFirmwareRevision[] = "FirmwareRevision";
-const char kFoundNetworks[] = "FoundNetworks";
-const char kHardwareRevision[] = "HardwareRevision";
-const char kHomeProvider[] = "HomeProvider";
-const char kICCID[] = "ICCID";
-const char kIMEI[] = "IMEI";
-const char kIMSI[] = "IMSI";
-const char kManufacturer[] = "Manufacturer";
-const char kMDN[] = "MDN";
-const char kMEID[] = "MEID";
-const char kMIN[] = "MIN";
-const char kModelID[] = "ModelID";
-const char kNetworkTechnology[] = "NetworkTechnology";
-const char kOperatorCode[] = "OperatorCode";
-const char kOperatorName[] = "OperatorName";
-const char kPRLVersion[] = "PRLVersion";
-const char kProviderRequiresRoaming[] = "ProviderRequiresRoaming";
-const char kRoamingState[] = "RoamingState";
-const char kSelectedNetwork[] = "SelectedNetwork";
-const char kServingOperator[] = "ServingOperator";
-const char kSIMLockStatus[] = "SIMLockStatus";
-const char kSIMPresent[] = "SIMPresent";
-const char kSupportedCarriers[] = "SupportedCarriers";
-const char kSupportNetworkScan[] = "SupportNetworkScan";
-} // namespace cellular
-
-namespace cellular_provider {
-const char kCode[] = "Code";
-const char kCountry[] = "Country";
-const char kName[] = "Name";
-} // namespace cellular_provider
-
-namespace cellular_apn {
-const char kName[] = "Name";
-const char kUsername[] = "Username";
-const char kPassword[] = "Password";
-} // namespace cellular_apn
-
-namespace connection_state {
-const char kConnected[] = "Connected";
-const char kConnecting[] = "Connecting";
-const char kNotConnected[] = "NotConnected";
-} // namespace connection_state
-
-namespace ethernet {
-const char kAuthentication[] = "Authentication";
-const char kEAP[] = "EAP";
-const char kNone[] = "None";
-const char k8021X[] = "8021X";
-} // namespace ethernet
-
-namespace ipconfig {
-const char kGateway[] = "Gateway";
-const char kIPAddress[] = "IPAddress";
-const char kIPv4[] = "IPv4";
-const char kIPv6[] = "IPv6";
-const char kRoutingPrefix[] = "RoutingPrefix";
-const char kType[] = "Type";
-} // namespace ipconfig
-
-namespace wifi {
-const char kAutoConnect[] = "AutoConnect";
-const char kBSSID[] = "BSSID";
-const char kEAP[] = "EAP";
-const char kFrequency[] = "Frequency";
-const char kFrequencyList[] = "FrequencyList";
-const char kHiddenSSID[] = "HiddenSSID";
-const char kNone[] = "None";
-const char kPassphrase[] = "Passphrase";
-const char kProxyURL[] = "ProxyURL";
-const char kSSID[] = "SSID";
-const char kSecurity[] = "Security";
-const char kSignalStrength[] = "SignalStrength";
-const char kWEP_8021X[] = "WEP-8021X";
-const char kWEP_PSK[] = "WEP-PSK";
-const char kWPA_EAP[] = "WPA-EAP";
-const char kWPA_PSK[] = "WPA-PSK";
-} // namespace wifi
-
-namespace certificate {
-const char kAuthority[] = "Authority";
-const char kClient[] = "Client";
-const char kCommonName[] = "CommonName";
-const char kEmailAddress[] = "EmailAddress";
-const char kEnrollmentURI[] = "EnrollmentURI";
-const char kGUID[] = "GUID";
-const char kIssuerCARef[] = "IssuerCARef";
-const char kIssuerCAPEMs[] = "IssuerCAPEMs";
-const char kIssuer[] = "Issuer";
-const char kLocality[] = "Locality";
-const char kNone[] = "None";
-const char kOrganization[] = "Organization";
-const char kOrganizationalUnit[] = "OrganizationalUnit";
-const char kPKCS12[] = "PKCS12";
-const char kPattern[] = "Pattern";
-const char kRef[] = "Ref";
-const char kServer[] = "Server";
-const char kSubject[] = "Subject";
-const char kTrustBits[] = "TrustBits";
-const char kType[] = "Type";
-const char kWeb[] = "Web";
-const char kX509[] = "X509";
-} // namespace certificate
-
-namespace encrypted {
-const char kAES256[] = "AES256";
-const char kCipher[] = "Cipher";
-const char kCiphertext[] = "Ciphertext";
-const char kHMACMethod[] = "HMACMethod";
-const char kHMAC[] = "HMAC";
-const char kIV[] = "IV";
-const char kIterations[] = "Iterations";
-const char kPBKDF2[] = "PBKDF2";
-const char kSHA1[] = "SHA1";
-const char kSalt[] = "Salt";
-const char kStretch[] = "Stretch";
-const char kType[] = "Type";
-} // namespace encrypted
-
-namespace eap {
-const char kAnonymousIdentity[] = "AnonymousIdentity";
-const char kAutomatic[] = "Automatic";
-const char kClientCertPattern[] = "ClientCertPattern";
-const char kClientCertRef[] = "ClientCertRef";
-const char kClientCertType[] = "ClientCertType";
-const char kEAP_AKA[] = "EAP-AKA";
-const char kEAP_FAST[] = "EAP-FAST";
-const char kEAP_SIM[] = "EAP-SIM";
-const char kEAP_TLS[] = "EAP-TLS";
-const char kEAP_TTLS[] = "EAP-TTLS";
-const char kIdentity[] = "Identity";
-const char kInner[] = "Inner";
-const char kLEAP[] = "LEAP";
-const char kMD5[] = "MD5";
-const char kMSCHAPv2[] = "MSCHAPv2";
-const char kOuter[] = "Outer";
-const char kPAP[] = "PAP";
-const char kPEAP[] = "PEAP";
-const char kPassword[] = "Password";
-const char kSaveCredentials[] = "SaveCredentials";
-const char kServerCAPEMs[] = "ServerCAPEMs";
-const char kServerCARef[] = "ServerCARef";
-const char kUseSystemCAs[] = "UseSystemCAs";
-} // namespace eap
-
-namespace vpn {
-const char kAutoConnect[] = "AutoConnect";
-const char kClientCertPattern[] = "ClientCertPattern";
-const char kClientCertRef[] = "ClientCertRef";
-const char kClientCertType[] = "ClientCertType";
-const char kHost[] = "Host";
-const char kIPsec[] = "IPsec";
-const char kL2TP[] = "L2TP";
-const char kOpenVPN[] = "OpenVPN";
-const char kPassword[] = "Password";
-const char kSaveCredentials[] = "SaveCredentials";
-const char kTypeL2TP_IPsec[] = "L2TP-IPsec";
-const char kType[] = "Type";
-const char kUsername[] = "Username";
-} // namespace vpn
-
-namespace ipsec {
-const char kAuthenticationType[] = "AuthenticationType";
-const char kCert[] = "Cert";
-const char kEAP[] = "EAP";
-const char kGroup[] = "Group";
-const char kIKEVersion[] = "IKEVersion";
-const char kPSK[] = "PSK";
-const char kServerCARef[] = "ServerCARef";
-const char kServerCAPEMs[] = "ServerCAPEMs";
-const char kXAUTH[] = "XAUTH";
-} // namespace ipsec
-
-namespace openvpn {
-const char kAuthNoCache[] = "AuthNoCache";
-const char kAuthRetry[] = "AuthRetry";
-const char kAuth[] = "Auth";
-const char kCipher[] = "Cipher";
-const char kCompLZO[] = "CompLZO";
-const char kCompNoAdapt[] = "CompNoAdapt";
-const char kInteract[] = "interact";
-const char kKeyDirection[] = "KeyDirection";
-const char kNoInteract[] = "nointeract";
-const char kNone[] = "none";
-const char kNsCertType[] = "NsCertType";
-const char kPort[] = "Port";
-const char kProto[] = "Proto";
-const char kPushPeerInfo[] = "PushPeerInfo";
-const char kRemoteCertEKU[] = "RemoteCertEKU";
-const char kRemoteCertKU[] = "RemoteCertKU";
-const char kRemoteCertTLS[] = "RemoteCertTLS";
-const char kRenegSec[] = "RenegSec";
-const char kServerCARef[] = "ServerCARef";
-const char kServerCAPEMs[] = "ServerCAPEMs";
-const char kServerCertPEM[] = "ServerCertPEM";
-const char kServerCertRef[] = "ServerCertRef";
-const char kServerPollTimeout[] = "ServerPollTimeout";
-const char kServer[] = "server";
-const char kShaper[] = "Shaper";
-const char kStaticChallenge[] = "StaticChallenge";
-const char kTLSAuthContents[] = "TLSAuthContents";
-const char kTLSRemote[] = "TLSRemote";
-const char kVerb[] = "Verb";
-} // namespace openvpn
-
-namespace proxy {
-const char kDirect[] = "Direct";
-const char kExcludeDomains[] = "ExcludeDomains";
-const char kFtp[] = "FTPProxy";
-const char kHost[] = "Host";
-const char kHttp[] = "HTTPProxy";
-const char kHttps[] = "SecureHTTPProxy";
-const char kManual[] = "Manual";
-const char kPAC[] = "PAC";
-const char kPort[] = "Port";
-const char kSocks[] = "SOCKS";
-const char kType[] = "Type";
-const char kWPAD[] = "WPAD";
-} // namespace proxy
-
-namespace substitutes {
-const char kLoginIDField[] = "${LOGIN_ID}";
-const char kEmailField[] = "${LOGIN_EMAIL}";
-} // namespace substitutes
-
-} // namespace onc
-
-} // namespace chromeos
diff --git a/chromeos/network/onc/onc_constants.h b/chromeos/network/onc/onc_constants.h
deleted file mode 100644
index dd87ce6..0000000
--- a/chromeos/network/onc/onc_constants.h
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#ifndef CHROMEOS_NETWORK_ONC_ONC_CONSTANTS_H_
-#define CHROMEOS_NETWORK_ONC_ONC_CONSTANTS_H_
-
-#include "chromeos/chromeos_export.h"
-
-namespace chromeos {
-
-// Constants for ONC properties.
-namespace onc {
-
-// Indicates from which source an ONC blob comes from.
-enum ONCSource {
- ONC_SOURCE_NONE,
- ONC_SOURCE_USER_IMPORT,
- ONC_SOURCE_DEVICE_POLICY,
- ONC_SOURCE_USER_POLICY,
-};
-
-// These keys are used to augment the dictionary resulting from merging the
-// different settings and policies.
-
-// The setting that Shill declared to be using. For example, if no policy and no
-// user setting exists, Shill might still report a property like network
-// security options or a SSID.
-CHROMEOS_EXPORT extern const char kAugmentationActiveSetting[];
-// The one of different setting sources (user/device policy, user/shared
-// settings) that has highest priority over the others.
-CHROMEOS_EXPORT extern const char kAugmentationEffectiveSetting[];
-CHROMEOS_EXPORT extern const char kAugmentationUnmanaged[];
-CHROMEOS_EXPORT extern const char kAugmentationUserPolicy[];
-CHROMEOS_EXPORT extern const char kAugmentationDevicePolicy[];
-CHROMEOS_EXPORT extern const char kAugmentationUserSetting[];
-CHROMEOS_EXPORT extern const char kAugmentationSharedSetting[];
-CHROMEOS_EXPORT extern const char kAugmentationUserEditable[];
-CHROMEOS_EXPORT extern const char kAugmentationDeviceEditable[];
-
-// This is no ONC key or value but used for logging only.
-// TODO(pneubeck): Remove.
-CHROMEOS_EXPORT extern const char kNetworkConfiguration[];
-
-// Common keys/values.
-CHROMEOS_EXPORT extern const char kRecommended[];
-CHROMEOS_EXPORT extern const char kRemove[];
-
-// Top Level Configuration
-namespace toplevel_config {
-CHROMEOS_EXPORT extern const char kCertificates[];
-CHROMEOS_EXPORT extern const char kEncryptedConfiguration[];
-CHROMEOS_EXPORT extern const char kNetworkConfigurations[];
-CHROMEOS_EXPORT extern const char kType[];
-CHROMEOS_EXPORT extern const char kUnencryptedConfiguration[];
-} // namespace toplevel_config
-
-// NetworkConfiguration.
-namespace network_config {
-CHROMEOS_EXPORT extern const char kCellular[];
-CHROMEOS_EXPORT extern const char kEthernet[];
-CHROMEOS_EXPORT extern const char kGUID[];
-CHROMEOS_EXPORT extern const char kIPConfigs[];
-CHROMEOS_EXPORT extern const char kName[];
-CHROMEOS_EXPORT extern const char kNameServers[];
-CHROMEOS_EXPORT extern const char kProxySettings[];
-CHROMEOS_EXPORT extern const char kSearchDomains[];
-CHROMEOS_EXPORT extern const char kServicePath[];
-CHROMEOS_EXPORT extern const char kConnectionState[];
-CHROMEOS_EXPORT extern const char kType[];
-CHROMEOS_EXPORT extern const char kVPN[];
-CHROMEOS_EXPORT extern const char kWiFi[];
-} // namespace network_config
-
-namespace network_type {
-CHROMEOS_EXPORT extern const char kAllTypes[];
-CHROMEOS_EXPORT extern const char kCellular[];
-CHROMEOS_EXPORT extern const char kEthernet[];
-CHROMEOS_EXPORT extern const char kVPN[];
-CHROMEOS_EXPORT extern const char kWiFi[];
-} // namespace network_type
-
-namespace cellular {
-CHROMEOS_EXPORT extern const char kActivateOverNonCellularNetwork[];
-CHROMEOS_EXPORT extern const char kActivationState[];
-CHROMEOS_EXPORT extern const char kAllowRoaming[];
-CHROMEOS_EXPORT extern const char kAPN[];
-CHROMEOS_EXPORT extern const char kCarrier[];
-CHROMEOS_EXPORT extern const char kESN[];
-CHROMEOS_EXPORT extern const char kFamily[];
-CHROMEOS_EXPORT extern const char kFirmwareRevision[];
-CHROMEOS_EXPORT extern const char kFoundNetworks[];
-CHROMEOS_EXPORT extern const char kHardwareRevision[];
-CHROMEOS_EXPORT extern const char kHomeProvider[];
-CHROMEOS_EXPORT extern const char kICCID[];
-CHROMEOS_EXPORT extern const char kIMEI[];
-CHROMEOS_EXPORT extern const char kIMSI[];
-CHROMEOS_EXPORT extern const char kManufacturer[];
-CHROMEOS_EXPORT extern const char kMDN[];
-CHROMEOS_EXPORT extern const char kMEID[];
-CHROMEOS_EXPORT extern const char kMIN[];
-CHROMEOS_EXPORT extern const char kModelID[];
-CHROMEOS_EXPORT extern const char kNetworkTechnology[];
-CHROMEOS_EXPORT extern const char kPRLVersion[];
-CHROMEOS_EXPORT extern const char kProviderRequiresRoaming[];
-CHROMEOS_EXPORT extern const char kRoamingState[];
-CHROMEOS_EXPORT extern const char kSelectedNetwork[];
-CHROMEOS_EXPORT extern const char kServingOperator[];
-CHROMEOS_EXPORT extern const char kSIMLockStatus[];
-CHROMEOS_EXPORT extern const char kSIMPresent[];
-CHROMEOS_EXPORT extern const char kSupportedCarriers[];
-CHROMEOS_EXPORT extern const char kSupportNetworkScan[];
-} // namespace cellular
-
-namespace cellular_provider {
-CHROMEOS_EXPORT extern const char kCode[];
-CHROMEOS_EXPORT extern const char kCountry[];
-CHROMEOS_EXPORT extern const char kName[];
-} // namespace cellular_provider
-
-namespace cellular_apn {
-CHROMEOS_EXPORT extern const char kName[];
-CHROMEOS_EXPORT extern const char kUsername[];
-CHROMEOS_EXPORT extern const char kPassword[];
-} // namespace cellular_apn
-
-
-namespace connection_state {
-CHROMEOS_EXPORT extern const char kConnected[];
-CHROMEOS_EXPORT extern const char kConnecting[];
-CHROMEOS_EXPORT extern const char kNotConnected[];
-} // namespace connection_state
-
-namespace ipconfig {
-CHROMEOS_EXPORT extern const char kGateway[];
-CHROMEOS_EXPORT extern const char kIPAddress[];
-CHROMEOS_EXPORT extern const char kIPv4[];
-CHROMEOS_EXPORT extern const char kIPv6[];
-CHROMEOS_EXPORT extern const char kRoutingPrefix[];
-CHROMEOS_EXPORT extern const char kType[];
-} // namespace ipconfig
-
-namespace ethernet {
-CHROMEOS_EXPORT extern const char kAuthentication[];
-CHROMEOS_EXPORT extern const char kEAP[];
-CHROMEOS_EXPORT extern const char kNone[];
-CHROMEOS_EXPORT extern const char k8021X[];
-} // namespace ethernet
-
-namespace wifi {
-CHROMEOS_EXPORT extern const char kAutoConnect[];
-CHROMEOS_EXPORT extern const char kBSSID[];
-CHROMEOS_EXPORT extern const char kEAP[];
-CHROMEOS_EXPORT extern const char kFrequency[];
-CHROMEOS_EXPORT extern const char kFrequencyList[];
-CHROMEOS_EXPORT extern const char kHiddenSSID[];
-CHROMEOS_EXPORT extern const char kNone[];
-CHROMEOS_EXPORT extern const char kPassphrase[];
-CHROMEOS_EXPORT extern const char kProxyURL[];
-CHROMEOS_EXPORT extern const char kSSID[];
-CHROMEOS_EXPORT extern const char kSecurity[];
-CHROMEOS_EXPORT extern const char kSignalStrength[];
-CHROMEOS_EXPORT extern const char kWEP_PSK[];
-CHROMEOS_EXPORT extern const char kWEP_8021X[];
-CHROMEOS_EXPORT extern const char kWPA_PSK[];
-CHROMEOS_EXPORT extern const char kWPA_EAP[];
-} // namespace wifi
-
-namespace certificate {
-CHROMEOS_EXPORT extern const char kAuthority[];
-CHROMEOS_EXPORT extern const char kClient[];
-CHROMEOS_EXPORT extern const char kCommonName[];
-CHROMEOS_EXPORT extern const char kEmailAddress[];
-CHROMEOS_EXPORT extern const char kEnrollmentURI[];
-CHROMEOS_EXPORT extern const char kGUID[];
-CHROMEOS_EXPORT extern const char kIssuerCARef[];
-CHROMEOS_EXPORT extern const char kIssuerCAPEMs[];
-CHROMEOS_EXPORT extern const char kIssuer[];
-CHROMEOS_EXPORT extern const char kLocality[];
-CHROMEOS_EXPORT extern const char kNone[];
-CHROMEOS_EXPORT extern const char kOrganization[];
-CHROMEOS_EXPORT extern const char kOrganizationalUnit[];
-CHROMEOS_EXPORT extern const char kPKCS12[];
-CHROMEOS_EXPORT extern const char kPattern[];
-CHROMEOS_EXPORT extern const char kRef[];
-CHROMEOS_EXPORT extern const char kServer[];
-CHROMEOS_EXPORT extern const char kSubject[];
-CHROMEOS_EXPORT extern const char kTrustBits[];
-CHROMEOS_EXPORT extern const char kType[];
-CHROMEOS_EXPORT extern const char kWeb[];
-CHROMEOS_EXPORT extern const char kX509[];
-} // namespace certificate
-
-namespace encrypted {
-CHROMEOS_EXPORT extern const char kAES256[];
-CHROMEOS_EXPORT extern const char kCipher[];
-CHROMEOS_EXPORT extern const char kCiphertext[];
-CHROMEOS_EXPORT extern const char kHMACMethod[];
-CHROMEOS_EXPORT extern const char kHMAC[];
-CHROMEOS_EXPORT extern const char kIV[];
-CHROMEOS_EXPORT extern const char kIterations[];
-CHROMEOS_EXPORT extern const char kPBKDF2[];
-CHROMEOS_EXPORT extern const char kSHA1[];
-CHROMEOS_EXPORT extern const char kSalt[];
-CHROMEOS_EXPORT extern const char kStretch[];
-} // namespace encrypted
-
-namespace eap {
-CHROMEOS_EXPORT extern const char kAnonymousIdentity[];
-CHROMEOS_EXPORT extern const char kAutomatic[];
-CHROMEOS_EXPORT extern const char kClientCertPattern[];
-CHROMEOS_EXPORT extern const char kClientCertRef[];
-CHROMEOS_EXPORT extern const char kClientCertType[];
-CHROMEOS_EXPORT extern const char kEAP_AKA[];
-CHROMEOS_EXPORT extern const char kEAP_FAST[];
-CHROMEOS_EXPORT extern const char kEAP_SIM[];
-CHROMEOS_EXPORT extern const char kEAP_TLS[];
-CHROMEOS_EXPORT extern const char kEAP_TTLS[];
-CHROMEOS_EXPORT extern const char kIdentity[];
-CHROMEOS_EXPORT extern const char kInner[];
-CHROMEOS_EXPORT extern const char kLEAP[];
-CHROMEOS_EXPORT extern const char kMD5[];
-CHROMEOS_EXPORT extern const char kMSCHAPv2[];
-CHROMEOS_EXPORT extern const char kOuter[];
-CHROMEOS_EXPORT extern const char kPAP[];
-CHROMEOS_EXPORT extern const char kPEAP[];
-CHROMEOS_EXPORT extern const char kPassword[];
-CHROMEOS_EXPORT extern const char kSaveCredentials[];
-CHROMEOS_EXPORT extern const char kServerCARef[];
-CHROMEOS_EXPORT extern const char kServerCAPEMs[];
-CHROMEOS_EXPORT extern const char kUseSystemCAs[];
-} // namespace eap
-
-namespace vpn {
-CHROMEOS_EXPORT extern const char kAutoConnect[];
-CHROMEOS_EXPORT extern const char kClientCertPattern[];
-CHROMEOS_EXPORT extern const char kClientCertRef[];
-CHROMEOS_EXPORT extern const char kClientCertType[];
-CHROMEOS_EXPORT extern const char kHost[];
-CHROMEOS_EXPORT extern const char kIPsec[];
-CHROMEOS_EXPORT extern const char kL2TP[];
-CHROMEOS_EXPORT extern const char kOpenVPN[];
-CHROMEOS_EXPORT extern const char kPassword[];
-CHROMEOS_EXPORT extern const char kSaveCredentials[];
-CHROMEOS_EXPORT extern const char kTypeL2TP_IPsec[];
-CHROMEOS_EXPORT extern const char kType[];
-CHROMEOS_EXPORT extern const char kUsername[];
-} // namespace vpn
-
-namespace ipsec {
-CHROMEOS_EXPORT extern const char kAuthenticationType[];
-CHROMEOS_EXPORT extern const char kCert[];
-CHROMEOS_EXPORT extern const char kEAP[];
-CHROMEOS_EXPORT extern const char kGroup[];
-CHROMEOS_EXPORT extern const char kIKEVersion[];
-CHROMEOS_EXPORT extern const char kPSK[];
-CHROMEOS_EXPORT extern const char kServerCARef[];
-CHROMEOS_EXPORT extern const char kServerCAPEMs[];
-CHROMEOS_EXPORT extern const char kXAUTH[];
-} // namespace ipsec
-
-namespace openvpn {
-CHROMEOS_EXPORT extern const char kAuthNoCache[];
-CHROMEOS_EXPORT extern const char kAuthRetry[];
-CHROMEOS_EXPORT extern const char kAuth[];
-CHROMEOS_EXPORT extern const char kCipher[];
-CHROMEOS_EXPORT extern const char kCompLZO[];
-CHROMEOS_EXPORT extern const char kCompNoAdapt[];
-CHROMEOS_EXPORT extern const char kInteract[];
-CHROMEOS_EXPORT extern const char kKeyDirection[];
-CHROMEOS_EXPORT extern const char kNoInteract[];
-CHROMEOS_EXPORT extern const char kNone[];
-CHROMEOS_EXPORT extern const char kNsCertType[];
-CHROMEOS_EXPORT extern const char kPort[];
-CHROMEOS_EXPORT extern const char kProto[];
-CHROMEOS_EXPORT extern const char kPushPeerInfo[];
-CHROMEOS_EXPORT extern const char kRemoteCertEKU[];
-CHROMEOS_EXPORT extern const char kRemoteCertKU[];
-CHROMEOS_EXPORT extern const char kRemoteCertTLS[];
-CHROMEOS_EXPORT extern const char kRenegSec[];
-CHROMEOS_EXPORT extern const char kServerCAPEMs[];
-CHROMEOS_EXPORT extern const char kServerCARef[];
-CHROMEOS_EXPORT extern const char kServerCertPEM[];
-CHROMEOS_EXPORT extern const char kServerCertRef[];
-CHROMEOS_EXPORT extern const char kServerPollTimeout[];
-CHROMEOS_EXPORT extern const char kServer[];
-CHROMEOS_EXPORT extern const char kShaper[];
-CHROMEOS_EXPORT extern const char kStaticChallenge[];
-CHROMEOS_EXPORT extern const char kTLSAuthContents[];
-CHROMEOS_EXPORT extern const char kTLSRemote[];
-CHROMEOS_EXPORT extern const char kVerb[];
-} // namespace openvpn
-
-namespace substitutes {
-CHROMEOS_EXPORT extern const char kEmailField[];
-CHROMEOS_EXPORT extern const char kLoginIDField[];
-} // namespace substitutes
-
-namespace proxy {
-CHROMEOS_EXPORT extern const char kDirect[];
-CHROMEOS_EXPORT extern const char kExcludeDomains[];
-CHROMEOS_EXPORT extern const char kFtp[];
-CHROMEOS_EXPORT extern const char kHost[];
-CHROMEOS_EXPORT extern const char kHttp[];
-CHROMEOS_EXPORT extern const char kHttps[];
-CHROMEOS_EXPORT extern const char kManual[];
-CHROMEOS_EXPORT extern const char kPAC[];
-CHROMEOS_EXPORT extern const char kPort[];
-CHROMEOS_EXPORT extern const char kSocks[];
-CHROMEOS_EXPORT extern const char kType[];
-CHROMEOS_EXPORT extern const char kWPAD[];
-} // namespace proxy
-
-} // namespace onc
-
-} // namespace chromeos
-
-#endif // CHROMEOS_NETWORK_ONC_ONC_CONSTANTS_H_
diff --git a/chromeos/network/onc/onc_merger.cc b/chromeos/network/onc/onc_merger.cc
index 57d40a1..93bfefe 100644
--- a/chromeos/network/onc/onc_merger.cc
+++ b/chromeos/network/onc/onc_merger.cc
@@ -11,8 +11,8 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
namespace onc {
@@ -25,7 +25,8 @@ typedef scoped_ptr<base::DictionaryValue> DictionaryPtr;
void MarkRecommendedFieldnames(const base::DictionaryValue& policy,
base::DictionaryValue* result) {
const base::ListValue* recommended_value = NULL;
- if (!policy.GetListWithoutPathExpansion(kRecommended, &recommended_value))
+ if (!policy.GetListWithoutPathExpansion(::onc::kRecommended,
+ &recommended_value))
return;
for (base::ListValue::const_iterator it = recommended_value->begin();
it != recommended_value->end(); ++it) {
@@ -45,7 +46,7 @@ DictionaryPtr GetEditableFlags(const base::DictionaryValue& policy) {
for (base::DictionaryValue::Iterator it(policy); !it.IsAtEnd();
it.Advance()) {
const base::DictionaryValue* child_policy = NULL;
- if (it.key() == kRecommended ||
+ if (it.key() == ::onc::kRecommended ||
!it.value().GetAsDictionary(&child_policy)) {
continue;
}
@@ -84,7 +85,7 @@ class MergeListOfDictionaries {
for (base::DictionaryValue::Iterator field(**it_outer); !field.IsAtEnd();
field.Advance()) {
const std::string& key = field.key();
- if (key == kRecommended || !visited.insert(key).second)
+ if (key == ::onc::kRecommended || !visited.insert(key).second)
continue;
scoped_ptr<base::Value> merged_value;
@@ -253,7 +254,8 @@ class MergeToEffective : public MergeSettingsAndPolicies {
// settings overwrites shared settings overwrites recommended policy). |which|
// is set to the respective onc::kAugmentation* constant that indicates which
// source of settings is effective. Note that this function may return a NULL
- // pointer and set |which| to kAugmentationUserPolicy, which means that the
+ // pointer and set |which| to ::onc::kAugmentationUserPolicy, which means that
+ // the
// user policy didn't set a value but also didn't recommend it, thus enforcing
// the empty value.
scoped_ptr<base::Value> MergeValues(const std::string& key,
@@ -263,22 +265,22 @@ class MergeToEffective : public MergeSettingsAndPolicies {
which->clear();
if (!values.user_editable) {
result = values.user_policy;
- *which = kAugmentationUserPolicy;
+ *which = ::onc::kAugmentationUserPolicy;
} else if (!values.device_editable) {
result = values.device_policy;
- *which = kAugmentationDevicePolicy;
+ *which = ::onc::kAugmentationDevicePolicy;
} else if (values.user_setting) {
result = values.user_setting;
- *which = kAugmentationUserSetting;
+ *which = ::onc::kAugmentationUserSetting;
} else if (values.shared_setting) {
result = values.shared_setting;
- *which = kAugmentationSharedSetting;
+ *which = ::onc::kAugmentationSharedSetting;
} else if (values.user_policy) {
result = values.user_policy;
- *which = kAugmentationUserPolicy;
+ *which = ::onc::kAugmentationUserPolicy;
} else if (values.device_policy) {
result = values.device_policy;
- *which = kAugmentationDevicePolicy;
+ *which = ::onc::kAugmentationDevicePolicy;
} else {
// Can be reached if the current field is recommended, but none of the
// dictionaries contained a value for it.
@@ -329,7 +331,7 @@ class MergeToAugmented : public MergeToEffective {
const ValueParams& values) OVERRIDE {
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
if (values.active_setting) {
- result->SetWithoutPathExpansion(kAugmentationActiveSetting,
+ result->SetWithoutPathExpansion(::onc::kAugmentationActiveSetting,
values.active_setting->DeepCopy());
}
@@ -343,8 +345,8 @@ class MergeToAugmented : public MergeToEffective {
std::string which_effective;
MergeToEffective::MergeValues(key, values, &which_effective).reset();
if (!which_effective.empty()) {
- result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting,
- which_effective);
+ result->SetStringWithoutPathExpansion(
+ ::onc::kAugmentationEffectiveSetting, which_effective);
}
bool is_credential = onc::FieldIsCredential(*signature_, key);
@@ -353,35 +355,35 @@ class MergeToAugmented : public MergeToEffective {
// leak here.
if (!is_credential) {
if (values.user_policy) {
- result->SetWithoutPathExpansion(kAugmentationUserPolicy,
+ result->SetWithoutPathExpansion(::onc::kAugmentationUserPolicy,
values.user_policy->DeepCopy());
}
if (values.device_policy) {
- result->SetWithoutPathExpansion(kAugmentationDevicePolicy,
+ result->SetWithoutPathExpansion(::onc::kAugmentationDevicePolicy,
values.device_policy->DeepCopy());
}
}
if (values.user_setting) {
- result->SetWithoutPathExpansion(kAugmentationUserSetting,
+ result->SetWithoutPathExpansion(::onc::kAugmentationUserSetting,
values.user_setting->DeepCopy());
}
if (values.shared_setting) {
- result->SetWithoutPathExpansion(kAugmentationSharedSetting,
+ result->SetWithoutPathExpansion(::onc::kAugmentationSharedSetting,
values.shared_setting->DeepCopy());
}
if (HasUserPolicy() && values.user_editable) {
- result->SetBooleanWithoutPathExpansion(kAugmentationUserEditable,
+ result->SetBooleanWithoutPathExpansion(::onc::kAugmentationUserEditable,
true);
}
if (HasDevicePolicy() && values.device_editable) {
- result->SetBooleanWithoutPathExpansion(kAugmentationDeviceEditable,
- true);
+ result->SetBooleanWithoutPathExpansion(
+ ::onc::kAugmentationDeviceEditable, true);
}
} else {
// This field is not part of the provided ONCSignature, thus it cannot be
// controlled by policy.
- result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting,
- kAugmentationUnmanaged);
+ result->SetStringWithoutPathExpansion(
+ ::onc::kAugmentationEffectiveSetting, ::onc::kAugmentationUnmanaged);
}
if (result->empty())
result.reset();
diff --git a/chromeos/network/onc/onc_merger_unittest.cc b/chromeos/network/onc/onc_merger_unittest.cc
index f0dbdc5..066803b 100644
--- a/chromeos/network/onc/onc_merger_unittest.cc
+++ b/chromeos/network/onc/onc_merger_unittest.cc
@@ -8,9 +8,9 @@
#include "base/logging.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_test_utils.h"
+#include "components/onc/onc_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
diff --git a/chromeos/network/onc/onc_normalizer.cc b/chromeos/network/onc/onc_normalizer.cc
index f7513a8..90d25f0 100644
--- a/chromeos/network/onc/onc_normalizer.cc
+++ b/chromeos/network/onc/onc_normalizer.cc
@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
namespace onc {
@@ -43,7 +43,7 @@ scoped_ptr<base::DictionaryValue> Normalizer::MapObject(
return scoped_ptr<base::DictionaryValue>();
if (remove_recommended_fields_)
- normalized->RemoveWithoutPathExpansion(kRecommended, NULL);
+ normalized->RemoveWithoutPathExpansion(::onc::kRecommended, NULL);
if (&signature == &kCertificateSignature)
NormalizeCertificate(normalized.get());
@@ -79,21 +79,21 @@ void RemoveEntryUnless(base::DictionaryValue* dict,
} // namespace
void Normalizer::NormalizeCertificate(base::DictionaryValue* cert) {
- using namespace certificate;
+ using namespace ::onc::certificate;
bool remove = false;
- cert->GetBooleanWithoutPathExpansion(kRemove, &remove);
- RemoveEntryUnless(cert, certificate::kType, !remove);
+ cert->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove);
+ RemoveEntryUnless(cert, ::onc::certificate::kType, !remove);
std::string type;
- cert->GetStringWithoutPathExpansion(certificate::kType, &type);
+ cert->GetStringWithoutPathExpansion(::onc::certificate::kType, &type);
RemoveEntryUnless(cert, kPKCS12, type == kClient);
RemoveEntryUnless(cert, kTrustBits, type == kServer || type == kAuthority);
RemoveEntryUnless(cert, kX509, type == kServer || type == kAuthority);
}
void Normalizer::NormalizeEthernet(base::DictionaryValue* ethernet) {
- using namespace ethernet;
+ using namespace ::onc::ethernet;
std::string auth;
ethernet->GetStringWithoutPathExpansion(kAuthentication, &auth);
@@ -101,13 +101,14 @@ void Normalizer::NormalizeEthernet(base::DictionaryValue* ethernet) {
}
void Normalizer::NormalizeEAP(base::DictionaryValue* eap) {
- using namespace eap;
+ using namespace ::onc::eap;
std::string clientcert_type;
eap->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type);
- RemoveEntryUnless(eap, kClientCertPattern,
- clientcert_type == certificate::kPattern);
- RemoveEntryUnless(eap, kClientCertRef, clientcert_type == certificate::kRef);
+ RemoveEntryUnless(
+ eap, kClientCertPattern, clientcert_type == ::onc::certificate::kPattern);
+ RemoveEntryUnless(
+ eap, kClientCertRef, clientcert_type == ::onc::certificate::kRef);
std::string outer;
eap->GetStringWithoutPathExpansion(kOuter, &outer);
@@ -118,21 +119,24 @@ void Normalizer::NormalizeEAP(base::DictionaryValue* eap) {
}
void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) {
- using namespace ipsec;
+ using namespace ::onc::ipsec;
std::string auth_type;
ipsec->GetStringWithoutPathExpansion(kAuthenticationType, &auth_type);
- RemoveEntryUnless(ipsec, vpn::kClientCertType, auth_type == kCert);
+ RemoveEntryUnless(ipsec, ::onc::vpn::kClientCertType, auth_type == kCert);
RemoveEntryUnless(ipsec, kServerCARef, auth_type == kCert);
RemoveEntryUnless(ipsec, kPSK, auth_type == kPSK);
- RemoveEntryUnless(ipsec, vpn::kSaveCredentials, auth_type == kPSK);
+ RemoveEntryUnless(ipsec, ::onc::vpn::kSaveCredentials, auth_type == kPSK);
std::string clientcert_type;
- ipsec->GetStringWithoutPathExpansion(vpn::kClientCertType, &clientcert_type);
- RemoveEntryUnless(ipsec, vpn::kClientCertPattern,
- clientcert_type == certificate::kPattern);
- RemoveEntryUnless(ipsec, vpn::kClientCertRef,
- clientcert_type == certificate::kRef);
+ ipsec->GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
+ &clientcert_type);
+ RemoveEntryUnless(ipsec,
+ ::onc::vpn::kClientCertPattern,
+ clientcert_type == ::onc::certificate::kPattern);
+ RemoveEntryUnless(ipsec,
+ ::onc::vpn::kClientCertRef,
+ clientcert_type == ::onc::certificate::kRef);
int ike_version = -1;
ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version);
@@ -143,62 +147,70 @@ void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) {
void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) {
bool remove = false;
- network->GetBooleanWithoutPathExpansion(kRemove, &remove);
+ network->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove);
if (remove) {
- network->RemoveWithoutPathExpansion(network_config::kIPConfigs, NULL);
- network->RemoveWithoutPathExpansion(network_config::kName, NULL);
- network->RemoveWithoutPathExpansion(network_config::kNameServers, NULL);
- network->RemoveWithoutPathExpansion(network_config::kProxySettings, NULL);
- network->RemoveWithoutPathExpansion(network_config::kSearchDomains, NULL);
- network->RemoveWithoutPathExpansion(network_config::kType, NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kIPConfigs,
+ NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kName, NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kNameServers,
+ NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kProxySettings,
+ NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kSearchDomains,
+ NULL);
+ network->RemoveWithoutPathExpansion(::onc::network_config::kType, NULL);
// Fields dependent on kType are removed afterwards, too.
}
std::string type;
- network->GetStringWithoutPathExpansion(network_config::kType, &type);
- RemoveEntryUnless(network, network_config::kEthernet,
- type == network_type::kEthernet);
- RemoveEntryUnless(network, network_config::kVPN, type == network_type::kVPN);
- RemoveEntryUnless(network, network_config::kWiFi,
- type == network_type::kWiFi);
+ network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type);
+ RemoveEntryUnless(network,
+ ::onc::network_config::kEthernet,
+ type == ::onc::network_type::kEthernet);
+ RemoveEntryUnless(
+ network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN);
+ RemoveEntryUnless(network,
+ ::onc::network_config::kWiFi,
+ type == ::onc::network_type::kWiFi);
}
void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) {
- using namespace vpn;
+ using namespace ::onc::vpn;
std::string clientcert_type;
openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type);
- RemoveEntryUnless(openvpn, kClientCertPattern,
- clientcert_type == certificate::kPattern);
- RemoveEntryUnless(openvpn, kClientCertRef,
- clientcert_type == certificate::kRef);
+ RemoveEntryUnless(openvpn,
+ kClientCertPattern,
+ clientcert_type == ::onc::certificate::kPattern);
+ RemoveEntryUnless(
+ openvpn, kClientCertRef, clientcert_type == ::onc::certificate::kRef);
}
void Normalizer::NormalizeProxySettings(base::DictionaryValue* proxy) {
- using namespace proxy;
+ using namespace ::onc::proxy;
std::string type;
- proxy->GetStringWithoutPathExpansion(proxy::kType, &type);
+ proxy->GetStringWithoutPathExpansion(::onc::proxy::kType, &type);
RemoveEntryUnless(proxy, kManual, type == kManual);
RemoveEntryUnless(proxy, kExcludeDomains, type == kManual);
RemoveEntryUnless(proxy, kPAC, type == kPAC);
}
void Normalizer::NormalizeVPN(base::DictionaryValue* vpn) {
- using namespace vpn;
+ using namespace ::onc::vpn;
std::string type;
- vpn->GetStringWithoutPathExpansion(vpn::kType, &type);
+ vpn->GetStringWithoutPathExpansion(::onc::vpn::kType, &type);
RemoveEntryUnless(vpn, kOpenVPN, type == kOpenVPN);
RemoveEntryUnless(vpn, kIPsec, type == kIPsec || type == kTypeL2TP_IPsec);
RemoveEntryUnless(vpn, kL2TP, type == kTypeL2TP_IPsec);
}
void Normalizer::NormalizeWiFi(base::DictionaryValue* wifi) {
- using namespace wifi;
+ using namespace ::onc::wifi;
std::string security;
- wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security);
+ wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP);
RemoveEntryUnless(wifi, kPassphrase,
security == kWEP_PSK || security == kWPA_PSK);
diff --git a/chromeos/network/onc/onc_signature.cc b/chromeos/network/onc/onc_signature.cc
index afed3a8..f5589d1 100644
--- a/chromeos/network/onc/onc_signature.cc
+++ b/chromeos/network/onc/onc_signature.cc
@@ -4,7 +4,7 @@
#include "chromeos/network/onc/onc_signature.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using base::Value;
@@ -33,279 +33,254 @@ const OncValueSignature kIPConfigListSignature = {
};
const OncFieldSignature issuer_subject_pattern_fields[] = {
- { certificate::kCommonName, &kStringSignature },
- { certificate::kLocality, &kStringSignature },
- { certificate::kOrganization, &kStringSignature },
- { certificate::kOrganizationalUnit, &kStringSignature },
- { NULL }
-};
+ { ::onc::certificate::kCommonName, &kStringSignature},
+ { ::onc::certificate::kLocality, &kStringSignature},
+ { ::onc::certificate::kOrganization, &kStringSignature},
+ { ::onc::certificate::kOrganizationalUnit, &kStringSignature},
+ {NULL}};
const OncFieldSignature certificate_pattern_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { certificate::kEnrollmentURI, &kStringListSignature },
- { certificate::kIssuer, &kIssuerSubjectPatternSignature },
- { certificate::kIssuerCARef, &kStringListSignature },
- { certificate::kIssuerCAPEMs, &kStringListSignature },
- { certificate::kSubject, &kIssuerSubjectPatternSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::certificate::kEnrollmentURI, &kStringListSignature},
+ { ::onc::certificate::kIssuer, &kIssuerSubjectPatternSignature},
+ { ::onc::certificate::kIssuerCARef, &kStringListSignature},
+ { ::onc::certificate::kIssuerCAPEMs, &kStringListSignature},
+ { ::onc::certificate::kSubject, &kIssuerSubjectPatternSignature},
+ {NULL}};
const OncFieldSignature eap_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { eap::kAnonymousIdentity, &kStringSignature },
- { eap::kClientCertPattern, &kCertificatePatternSignature },
- { eap::kClientCertRef, &kStringSignature },
- { eap::kClientCertType, &kStringSignature },
- { eap::kIdentity, &kStringSignature },
- { eap::kInner, &kStringSignature },
- { eap::kOuter, &kStringSignature },
- { eap::kPassword, &kStringSignature },
- { eap::kSaveCredentials, &kBoolSignature },
- { eap::kServerCAPEMs, &kStringListSignature },
- { eap::kServerCARef, &kStringSignature },
- { eap::kUseSystemCAs, &kBoolSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::eap::kAnonymousIdentity, &kStringSignature},
+ { ::onc::eap::kClientCertPattern, &kCertificatePatternSignature},
+ { ::onc::eap::kClientCertRef, &kStringSignature},
+ { ::onc::eap::kClientCertType, &kStringSignature},
+ { ::onc::eap::kIdentity, &kStringSignature},
+ { ::onc::eap::kInner, &kStringSignature},
+ { ::onc::eap::kOuter, &kStringSignature},
+ { ::onc::eap::kPassword, &kStringSignature},
+ { ::onc::eap::kSaveCredentials, &kBoolSignature},
+ { ::onc::eap::kServerCAPEMs, &kStringListSignature},
+ { ::onc::eap::kServerCARef, &kStringSignature},
+ { ::onc::eap::kUseSystemCAs, &kBoolSignature},
+ {NULL}};
const OncFieldSignature ipsec_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { ipsec::kAuthenticationType, &kStringSignature },
- { vpn::kClientCertPattern, &kCertificatePatternSignature },
- { vpn::kClientCertRef, &kStringSignature },
- { vpn::kClientCertType, &kStringSignature },
- { ipsec::kGroup, &kStringSignature },
- { ipsec::kIKEVersion, &kIntegerSignature },
- { ipsec::kPSK, &kStringSignature },
- { vpn::kSaveCredentials, &kBoolSignature },
- { ipsec::kServerCAPEMs, &kStringSignature },
- { ipsec::kServerCARef, &kStringSignature },
- // Not yet supported.
- // { ipsec::kEAP, &kEAPSignature },
- // { ipsec::kXAUTH, &kXAUTHSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::ipsec::kAuthenticationType, &kStringSignature},
+ { ::onc::vpn::kClientCertPattern, &kCertificatePatternSignature},
+ { ::onc::vpn::kClientCertRef, &kStringSignature},
+ { ::onc::vpn::kClientCertType, &kStringSignature},
+ { ::onc::ipsec::kGroup, &kStringSignature},
+ { ::onc::ipsec::kIKEVersion, &kIntegerSignature},
+ { ::onc::ipsec::kPSK, &kStringSignature},
+ { ::onc::vpn::kSaveCredentials, &kBoolSignature},
+ { ::onc::ipsec::kServerCAPEMs, &kStringSignature},
+ { ::onc::ipsec::kServerCARef, &kStringSignature},
+ // Not yet supported.
+ // { ipsec::kEAP, &kEAPSignature },
+ // { ipsec::kXAUTH, &kXAUTHSignature },
+ {NULL}};
const OncFieldSignature l2tp_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { vpn::kPassword, &kStringSignature },
- { vpn::kSaveCredentials, &kBoolSignature },
- { vpn::kUsername, &kStringSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::vpn::kPassword, &kStringSignature},
+ { ::onc::vpn::kSaveCredentials, &kBoolSignature},
+ { ::onc::vpn::kUsername, &kStringSignature},
+ {NULL}};
const OncFieldSignature openvpn_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { openvpn::kAuth, &kStringSignature },
- { openvpn::kAuthNoCache, &kBoolSignature },
- { openvpn::kAuthRetry, &kStringSignature },
- { openvpn::kCipher, &kStringSignature },
- { vpn::kClientCertPattern, &kCertificatePatternSignature },
- { vpn::kClientCertRef, &kStringSignature },
- { vpn::kClientCertType, &kStringSignature },
- { openvpn::kCompLZO, &kStringSignature },
- { openvpn::kCompNoAdapt, &kBoolSignature },
- { openvpn::kKeyDirection, &kStringSignature },
- { openvpn::kNsCertType, &kStringSignature },
- { vpn::kPassword, &kStringSignature },
- { openvpn::kPort, &kIntegerSignature },
- { openvpn::kProto, &kStringSignature },
- { openvpn::kPushPeerInfo, &kBoolSignature },
- { openvpn::kRemoteCertEKU, &kStringSignature },
- { openvpn::kRemoteCertKU, &kStringListSignature },
- { openvpn::kRemoteCertTLS, &kStringSignature },
- { openvpn::kRenegSec, &kIntegerSignature },
- { vpn::kSaveCredentials, &kBoolSignature },
- { openvpn::kServerCAPEMs, &kStringListSignature },
- { openvpn::kServerCARef, &kStringSignature },
- // Not supported, yet.
- { openvpn::kServerCertPEM, &kStringSignature },
- { openvpn::kServerCertRef, &kStringSignature },
- { openvpn::kServerPollTimeout, &kIntegerSignature },
- { openvpn::kShaper, &kIntegerSignature },
- { openvpn::kStaticChallenge, &kStringSignature },
- { openvpn::kTLSAuthContents, &kStringSignature },
- { openvpn::kTLSRemote, &kStringSignature },
- { vpn::kUsername, &kStringSignature },
- // Not supported, yet.
- { openvpn::kVerb, &kStringSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::openvpn::kAuth, &kStringSignature},
+ { ::onc::openvpn::kAuthNoCache, &kBoolSignature},
+ { ::onc::openvpn::kAuthRetry, &kStringSignature},
+ { ::onc::openvpn::kCipher, &kStringSignature},
+ { ::onc::vpn::kClientCertPattern, &kCertificatePatternSignature},
+ { ::onc::vpn::kClientCertRef, &kStringSignature},
+ { ::onc::vpn::kClientCertType, &kStringSignature},
+ { ::onc::openvpn::kCompLZO, &kStringSignature},
+ { ::onc::openvpn::kCompNoAdapt, &kBoolSignature},
+ { ::onc::openvpn::kKeyDirection, &kStringSignature},
+ { ::onc::openvpn::kNsCertType, &kStringSignature},
+ { ::onc::vpn::kPassword, &kStringSignature},
+ { ::onc::openvpn::kPort, &kIntegerSignature},
+ { ::onc::openvpn::kProto, &kStringSignature},
+ { ::onc::openvpn::kPushPeerInfo, &kBoolSignature},
+ { ::onc::openvpn::kRemoteCertEKU, &kStringSignature},
+ { ::onc::openvpn::kRemoteCertKU, &kStringListSignature},
+ { ::onc::openvpn::kRemoteCertTLS, &kStringSignature},
+ { ::onc::openvpn::kRenegSec, &kIntegerSignature},
+ { ::onc::vpn::kSaveCredentials, &kBoolSignature},
+ { ::onc::openvpn::kServerCAPEMs, &kStringListSignature},
+ { ::onc::openvpn::kServerCARef, &kStringSignature},
+ // Not supported, yet.
+ { ::onc::openvpn::kServerCertPEM, &kStringSignature},
+ { ::onc::openvpn::kServerCertRef, &kStringSignature},
+ { ::onc::openvpn::kServerPollTimeout, &kIntegerSignature},
+ { ::onc::openvpn::kShaper, &kIntegerSignature},
+ { ::onc::openvpn::kStaticChallenge, &kStringSignature},
+ { ::onc::openvpn::kTLSAuthContents, &kStringSignature},
+ { ::onc::openvpn::kTLSRemote, &kStringSignature},
+ { ::onc::vpn::kUsername, &kStringSignature},
+ // Not supported, yet.
+ { ::onc::openvpn::kVerb, &kStringSignature},
+ {NULL}};
const OncFieldSignature vpn_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { vpn::kAutoConnect, &kBoolSignature },
- { vpn::kHost, &kStringSignature },
- { vpn::kIPsec, &kIPsecSignature },
- { vpn::kL2TP, &kL2TPSignature },
- { vpn::kOpenVPN, &kOpenVPNSignature },
- { vpn::kType, &kStringSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::vpn::kAutoConnect, &kBoolSignature},
+ { ::onc::vpn::kHost, &kStringSignature},
+ { ::onc::vpn::kIPsec, &kIPsecSignature},
+ { ::onc::vpn::kL2TP, &kL2TPSignature},
+ { ::onc::vpn::kOpenVPN, &kOpenVPNSignature},
+ { ::onc::vpn::kType, &kStringSignature},
+ {NULL}};
const OncFieldSignature ethernet_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { ethernet::kAuthentication, &kStringSignature },
- { ethernet::kEAP, &kEAPSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::ethernet::kAuthentication, &kStringSignature},
+ { ::onc::ethernet::kEAP, &kEAPSignature},
+ {NULL}};
// Not supported, yet.
const OncFieldSignature ipconfig_fields[] = {
- { ipconfig::kGateway, &kStringSignature },
- { ipconfig::kIPAddress, &kStringSignature },
- { network_config::kNameServers, &kStringSignature },
- { ipconfig::kRoutingPrefix, &kIntegerSignature },
- { network_config::kSearchDomains, &kStringListSignature },
- { ipconfig::kType, &kStringSignature },
- { NULL }
-};
+ { ::onc::ipconfig::kGateway, &kStringSignature},
+ { ::onc::ipconfig::kIPAddress, &kStringSignature},
+ { ::onc::network_config::kNameServers, &kStringSignature},
+ { ::onc::ipconfig::kRoutingPrefix, &kIntegerSignature},
+ { ::onc::network_config::kSearchDomains, &kStringListSignature},
+ { ::onc::ipconfig::kType, &kStringSignature},
+ {NULL}};
const OncFieldSignature proxy_location_fields[] = {
- { proxy::kHost, &kStringSignature },
- { proxy::kPort, &kIntegerSignature },
- { NULL }
-};
+ { ::onc::proxy::kHost, &kStringSignature},
+ { ::onc::proxy::kPort, &kIntegerSignature}, {NULL}};
const OncFieldSignature proxy_manual_fields[] = {
- { proxy::kFtp, &kProxyLocationSignature },
- { proxy::kHttp, &kProxyLocationSignature },
- { proxy::kHttps, &kProxyLocationSignature },
- { proxy::kSocks, &kProxyLocationSignature },
- { NULL }
-};
+ { ::onc::proxy::kFtp, &kProxyLocationSignature},
+ { ::onc::proxy::kHttp, &kProxyLocationSignature},
+ { ::onc::proxy::kHttps, &kProxyLocationSignature},
+ { ::onc::proxy::kSocks, &kProxyLocationSignature},
+ {NULL}};
const OncFieldSignature proxy_settings_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { proxy::kExcludeDomains, &kStringListSignature },
- { proxy::kManual, &kProxyManualSignature },
- { proxy::kPAC, &kStringSignature },
- { proxy::kType, &kStringSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::proxy::kExcludeDomains, &kStringListSignature},
+ { ::onc::proxy::kManual, &kProxyManualSignature},
+ { ::onc::proxy::kPAC, &kStringSignature},
+ { ::onc::proxy::kType, &kStringSignature},
+ {NULL}};
const OncFieldSignature wifi_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { wifi::kAutoConnect, &kBoolSignature },
- { wifi::kEAP, &kEAPSignature },
- { wifi::kHiddenSSID, &kBoolSignature },
- { wifi::kPassphrase, &kStringSignature },
- { wifi::kSSID, &kStringSignature },
- { wifi::kSecurity, &kStringSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::wifi::kAutoConnect, &kBoolSignature},
+ { ::onc::wifi::kEAP, &kEAPSignature},
+ { ::onc::wifi::kHiddenSSID, &kBoolSignature},
+ { ::onc::wifi::kPassphrase, &kStringSignature},
+ { ::onc::wifi::kSSID, &kStringSignature},
+ { ::onc::wifi::kSecurity, &kStringSignature},
+ {NULL}};
const OncFieldSignature wifi_with_state_fields[] = {
- { wifi::kBSSID, &kStringSignature },
- { wifi::kFrequency, &kIntegerSignature },
- { wifi::kFrequencyList, &kIntegerListSignature },
- { wifi::kSignalStrength, &kIntegerSignature },
- { NULL }
-};
+ { ::onc::wifi::kBSSID, &kStringSignature},
+ { ::onc::wifi::kFrequency, &kIntegerSignature},
+ { ::onc::wifi::kFrequencyList, &kIntegerListSignature},
+ { ::onc::wifi::kSignalStrength, &kIntegerSignature},
+ {NULL}};
const OncFieldSignature cellular_provider_fields[] = {
- { cellular_provider::kCode, &kStringSignature },
- { cellular_provider::kCountry, &kStringSignature },
- { cellular_provider::kName, &kStringSignature },
- { NULL }
-};
+ { ::onc::cellular_provider::kCode, &kStringSignature},
+ { ::onc::cellular_provider::kCountry, &kStringSignature},
+ { ::onc::cellular_provider::kName, &kStringSignature},
+ {NULL}};
const OncFieldSignature cellular_apn_fields[] = {
- { cellular_apn::kName, &kStringSignature },
- { cellular_apn::kUsername, &kStringSignature },
- { cellular_apn::kPassword, &kStringSignature },
- { NULL }
-};
+ { ::onc::cellular_apn::kName, &kStringSignature},
+ { ::onc::cellular_apn::kUsername, &kStringSignature},
+ { ::onc::cellular_apn::kPassword, &kStringSignature},
+ {NULL}};
const OncFieldSignature cellular_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { cellular::kAPN, &kCellularApnSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::cellular::kAPN, &kCellularApnSignature}, {NULL}};
const OncFieldSignature cellular_with_state_fields[] = {
- { cellular::kActivateOverNonCellularNetwork, &kBoolSignature },
- { cellular::kActivationState, &kStringSignature },
- { cellular::kAllowRoaming, &kStringSignature },
- { cellular::kCarrier, &kStringSignature },
- { cellular::kESN, &kStringSignature },
- { cellular::kFamily, &kStringSignature },
- { cellular::kFirmwareRevision, &kStringSignature },
- { cellular::kFoundNetworks, &kStringSignature },
- { cellular::kHardwareRevision, &kStringSignature },
- { cellular::kHomeProvider, &kCellularProviderSignature },
- { cellular::kICCID, &kStringSignature },
- { cellular::kIMEI, &kStringSignature },
- { cellular::kIMSI, &kStringSignature },
- { cellular::kManufacturer, &kStringSignature },
- { cellular::kMDN, &kStringSignature },
- { cellular::kMEID, &kStringSignature },
- { cellular::kMIN, &kStringSignature },
- { cellular::kModelID, &kStringSignature },
- { cellular::kNetworkTechnology, &kStringSignature },
- { cellular::kPRLVersion, &kStringSignature },
- { cellular::kProviderRequiresRoaming, &kStringSignature },
- { cellular::kRoamingState, &kStringSignature },
- { cellular::kSelectedNetwork, &kStringSignature },
- { cellular::kServingOperator, &kCellularProviderSignature },
- { cellular::kSIMLockStatus, &kStringSignature },
- { cellular::kSIMPresent, &kStringSignature },
- { cellular::kSupportedCarriers, &kStringSignature },
- { cellular::kSupportNetworkScan, &kStringSignature },
- { NULL }
-};
+ { ::onc::cellular::kActivateOverNonCellularNetwork, &kBoolSignature},
+ { ::onc::cellular::kActivationState, &kStringSignature},
+ { ::onc::cellular::kAllowRoaming, &kStringSignature},
+ { ::onc::cellular::kCarrier, &kStringSignature},
+ { ::onc::cellular::kESN, &kStringSignature},
+ { ::onc::cellular::kFamily, &kStringSignature},
+ { ::onc::cellular::kFirmwareRevision, &kStringSignature},
+ { ::onc::cellular::kFoundNetworks, &kStringSignature},
+ { ::onc::cellular::kHardwareRevision, &kStringSignature},
+ { ::onc::cellular::kHomeProvider, &kCellularProviderSignature},
+ { ::onc::cellular::kICCID, &kStringSignature},
+ { ::onc::cellular::kIMEI, &kStringSignature},
+ { ::onc::cellular::kIMSI, &kStringSignature},
+ { ::onc::cellular::kManufacturer, &kStringSignature},
+ { ::onc::cellular::kMDN, &kStringSignature},
+ { ::onc::cellular::kMEID, &kStringSignature},
+ { ::onc::cellular::kMIN, &kStringSignature},
+ { ::onc::cellular::kModelID, &kStringSignature},
+ { ::onc::cellular::kNetworkTechnology, &kStringSignature},
+ { ::onc::cellular::kPRLVersion, &kStringSignature},
+ { ::onc::cellular::kProviderRequiresRoaming, &kStringSignature},
+ { ::onc::cellular::kRoamingState, &kStringSignature},
+ { ::onc::cellular::kSelectedNetwork, &kStringSignature},
+ { ::onc::cellular::kServingOperator, &kCellularProviderSignature},
+ { ::onc::cellular::kSIMLockStatus, &kStringSignature},
+ { ::onc::cellular::kSIMPresent, &kStringSignature},
+ { ::onc::cellular::kSupportedCarriers, &kStringSignature},
+ { ::onc::cellular::kSupportNetworkScan, &kStringSignature},
+ {NULL}};
const OncFieldSignature network_configuration_fields[] = {
- { kRecommended, &kRecommendedSignature },
- { network_config::kEthernet, &kEthernetSignature },
- { network_config::kGUID, &kStringSignature },
- // Not supported, yet.
- { network_config::kIPConfigs, &kIPConfigListSignature },
- { network_config::kName, &kStringSignature },
- // Not supported, yet.
- { network_config::kNameServers, &kStringListSignature },
- { network_config::kProxySettings, &kProxySettingsSignature },
- { kRemove, &kBoolSignature },
- // Not supported, yet.
- { network_config::kSearchDomains, &kStringListSignature },
- { network_config::kType, &kStringSignature },
- { network_config::kVPN, &kVPNSignature },
- { network_config::kWiFi, &kWiFiSignature },
- { network_config::kCellular, &kCellularSignature },
- { NULL }
-};
+ { ::onc::kRecommended, &kRecommendedSignature},
+ { ::onc::network_config::kEthernet, &kEthernetSignature},
+ { ::onc::network_config::kGUID, &kStringSignature},
+ // Not supported, yet.
+ { ::onc::network_config::kIPConfigs, &kIPConfigListSignature},
+ { ::onc::network_config::kName, &kStringSignature},
+ // Not supported, yet.
+ { ::onc::network_config::kNameServers, &kStringListSignature},
+ { ::onc::network_config::kProxySettings, &kProxySettingsSignature},
+ { ::onc::kRemove, &kBoolSignature},
+ // Not supported, yet.
+ { ::onc::network_config::kSearchDomains, &kStringListSignature},
+ { ::onc::network_config::kType, &kStringSignature},
+ { ::onc::network_config::kVPN, &kVPNSignature},
+ { ::onc::network_config::kWiFi, &kWiFiSignature},
+ { ::onc::network_config::kCellular, &kCellularSignature},
+ {NULL}};
const OncFieldSignature network_with_state_fields[] = {
- { network_config::kCellular, &kCellularWithStateSignature },
- { network_config::kConnectionState, &kStringSignature },
- { network_config::kWiFi, &kWiFiWithStateSignature },
- { NULL }
-};
+ { ::onc::network_config::kCellular, &kCellularWithStateSignature},
+ { ::onc::network_config::kConnectionState, &kStringSignature},
+ { ::onc::network_config::kWiFi, &kWiFiWithStateSignature},
+ {NULL}};
const OncFieldSignature certificate_fields[] = {
- { certificate::kGUID, &kStringSignature },
- { certificate::kPKCS12, &kStringSignature },
- { kRemove, &kBoolSignature },
- { certificate::kTrustBits, &kStringListSignature },
- { certificate::kType, &kStringSignature },
- { certificate::kX509, &kStringSignature },
- { NULL }
-};
+ { ::onc::certificate::kGUID, &kStringSignature},
+ { ::onc::certificate::kPKCS12, &kStringSignature},
+ { ::onc::kRemove, &kBoolSignature},
+ { ::onc::certificate::kTrustBits, &kStringListSignature},
+ { ::onc::certificate::kType, &kStringSignature},
+ { ::onc::certificate::kX509, &kStringSignature},
+ {NULL}};
const OncFieldSignature toplevel_configuration_fields[] = {
- { toplevel_config::kCertificates, &kCertificateListSignature },
- { toplevel_config::kNetworkConfigurations,
- &kNetworkConfigurationListSignature },
- { toplevel_config::kType, &kStringSignature },
- { encrypted::kCipher, &kStringSignature },
- { encrypted::kCiphertext, &kStringSignature },
- { encrypted::kHMAC, &kStringSignature },
- { encrypted::kHMACMethod, &kStringSignature },
- { encrypted::kIV, &kStringSignature },
- { encrypted::kIterations, &kIntegerSignature },
- { encrypted::kSalt, &kStringSignature },
- { encrypted::kStretch, &kStringSignature },
- { NULL }
-};
+ { ::onc::toplevel_config::kCertificates, &kCertificateListSignature},
+ { ::onc::toplevel_config::kNetworkConfigurations,
+ &kNetworkConfigurationListSignature},
+ { ::onc::toplevel_config::kType, &kStringSignature},
+ { ::onc::encrypted::kCipher, &kStringSignature},
+ { ::onc::encrypted::kCiphertext, &kStringSignature},
+ { ::onc::encrypted::kHMAC, &kStringSignature},
+ { ::onc::encrypted::kHMACMethod, &kStringSignature},
+ { ::onc::encrypted::kIV, &kStringSignature},
+ { ::onc::encrypted::kIterations, &kIntegerSignature},
+ { ::onc::encrypted::kSalt, &kStringSignature},
+ { ::onc::encrypted::kStretch, &kStringSignature}, {NULL}};
} // namespace
@@ -410,15 +385,14 @@ struct CredentialEntry {
};
const CredentialEntry credentials[] = {
- { &kEAPSignature, onc::eap::kPassword },
- { &kIPsecSignature, onc::ipsec::kPSK },
- { &kL2TPSignature, onc::vpn::kPassword },
- { &kOpenVPNSignature, onc::vpn::kPassword },
- { &kOpenVPNSignature, onc::openvpn::kTLSAuthContents },
- { &kWiFiSignature, onc::wifi::kPassphrase },
- { &kCellularApnSignature, onc::cellular_apn::kPassword },
- { NULL }
-};
+ {&kEAPSignature, ::onc::eap::kPassword},
+ {&kIPsecSignature, ::onc::ipsec::kPSK},
+ {&kL2TPSignature, ::onc::vpn::kPassword},
+ {&kOpenVPNSignature, ::onc::vpn::kPassword},
+ {&kOpenVPNSignature, ::onc::openvpn::kTLSAuthContents},
+ {&kWiFiSignature, ::onc::wifi::kPassphrase},
+ {&kCellularApnSignature, ::onc::cellular_apn::kPassword},
+ {NULL}};
} // namespace
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index 690df0b..ce6dd3e 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -7,7 +7,7 @@
#include <cstddef>
#include "base/logging.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -24,152 +24,143 @@ namespace onc {
namespace {
const FieldTranslationEntry eap_fields[] = {
- { eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty },
- { eap::kIdentity, shill::kEapIdentityProperty },
- // This field is converted during translation, see onc_translator_*.
- // { eap::kInner, shill::kEapPhase2AuthProperty },
-
- // This field is converted during translation, see onc_translator_*.
- // { eap::kOuter, shill::kEapMethodProperty },
- { eap::kPassword, shill::kEapPasswordProperty },
- { eap::kSaveCredentials, shill::kSaveCredentialsProperty },
- { eap::kServerCAPEMs, shill::kEapCaCertPemProperty },
- { eap::kUseSystemCAs, shill::kEapUseSystemCasProperty },
- { NULL }
-};
+ { ::onc::eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty},
+ { ::onc::eap::kIdentity, shill::kEapIdentityProperty},
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::eap::kInner, shill::kEapPhase2AuthProperty },
+
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::eap::kOuter, shill::kEapMethodProperty },
+ { ::onc::eap::kPassword, shill::kEapPasswordProperty},
+ { ::onc::eap::kSaveCredentials, shill::kSaveCredentialsProperty},
+ { ::onc::eap::kServerCAPEMs, shill::kEapCaCertPemProperty},
+ { ::onc::eap::kUseSystemCAs, shill::kEapUseSystemCasProperty},
+ {NULL}};
const FieldTranslationEntry ipsec_fields[] = {
- // Ignored by Shill, not necessary to synchronize.
- // { ipsec::kAuthenticationType, shill::kL2tpIpsecAuthenticationType },
- { ipsec::kGroup, shill::kL2tpIpsecTunnelGroupProperty },
- // Ignored by Shill, not necessary to synchronize.
- // { ipsec::kIKEVersion, shill::kL2tpIpsecIkeVersion },
- { ipsec::kPSK, shill::kL2tpIpsecPskProperty },
- { vpn::kSaveCredentials, shill::kSaveCredentialsProperty },
- { ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty },
- { NULL }
-};
+ // Ignored by Shill, not necessary to synchronize.
+ // { ::onc::ipsec::kAuthenticationType, shill::kL2tpIpsecAuthenticationType
+ // },
+ { ::onc::ipsec::kGroup, shill::kL2tpIpsecTunnelGroupProperty},
+ // Ignored by Shill, not necessary to synchronize.
+ // { ::onc::ipsec::kIKEVersion, shill::kL2tpIpsecIkeVersion },
+ { ::onc::ipsec::kPSK, shill::kL2tpIpsecPskProperty},
+ { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty},
+ { ::onc::ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty},
+ {NULL}};
const FieldTranslationEntry l2tp_fields[] = {
- { vpn::kPassword, shill::kL2tpIpsecPasswordProperty },
- // We don't synchronize l2tp's SaveCredentials field for now, as Shill doesn't
- // support separate settings for ipsec and l2tp.
- // { vpn::kSaveCredentials, &kBoolSignature },
- { vpn::kUsername, shill::kL2tpIpsecUserProperty },
- { NULL }
-};
+ { ::onc::vpn::kPassword, shill::kL2tpIpsecPasswordProperty},
+ // We don't synchronize l2tp's SaveCredentials field for now, as Shill
+ // doesn't
+ // support separate settings for ipsec and l2tp.
+ // { ::onc::vpn::kSaveCredentials, &kBoolSignature },
+ { ::onc::vpn::kUsername, shill::kL2tpIpsecUserProperty}, {NULL}};
const FieldTranslationEntry openvpn_fields[] = {
- { openvpn::kAuth, shill::kOpenVPNAuthProperty },
- { openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty },
- { openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty },
- { openvpn::kCipher, shill::kOpenVPNCipherProperty },
- { openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty },
- { openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty },
- { openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty },
- { openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty },
- { vpn::kPassword, shill::kOpenVPNPasswordProperty },
- { openvpn::kPort, shill::kOpenVPNPortProperty },
- { openvpn::kProto, shill::kOpenVPNProtoProperty },
- { openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty },
- { openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty },
- // This field is converted during translation, see onc_translator_*.
- // { openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty },
- { openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty },
- { openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty },
- { vpn::kSaveCredentials, shill::kSaveCredentialsProperty },
- { openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty },
- { openvpn::kServerPollTimeout, shill::kOpenVPNServerPollTimeoutProperty },
- { openvpn::kShaper, shill::kOpenVPNShaperProperty },
- { openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty },
- { openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty },
- { openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty },
- { vpn::kUsername, shill::kOpenVPNUserProperty },
- { NULL }
-};
+ { ::onc::openvpn::kAuth, shill::kOpenVPNAuthProperty},
+ { ::onc::openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty},
+ { ::onc::openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty},
+ { ::onc::openvpn::kCipher, shill::kOpenVPNCipherProperty},
+ { ::onc::openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty},
+ { ::onc::openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty},
+ { ::onc::openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty},
+ { ::onc::openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty},
+ { ::onc::vpn::kPassword, shill::kOpenVPNPasswordProperty},
+ { ::onc::openvpn::kPort, shill::kOpenVPNPortProperty},
+ { ::onc::openvpn::kProto, shill::kOpenVPNProtoProperty},
+ { ::onc::openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty},
+ { ::onc::openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty},
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty },
+ { ::onc::openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty},
+ { ::onc::openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty},
+ { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty},
+ { ::onc::openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty},
+ { ::onc::openvpn::kServerPollTimeout,
+ shill::kOpenVPNServerPollTimeoutProperty},
+ { ::onc::openvpn::kShaper, shill::kOpenVPNShaperProperty},
+ { ::onc::openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty},
+ { ::onc::openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty},
+ { ::onc::openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty},
+ { ::onc::vpn::kUsername, shill::kOpenVPNUserProperty}, {NULL}};
const FieldTranslationEntry vpn_fields[] = {
- { vpn::kAutoConnect, shill::kAutoConnectProperty },
- { vpn::kHost, shill::kProviderHostProperty },
- // This field is converted during translation, see onc_translator_*.
- // { vpn::kType, shill::kProviderTypeProperty },
- { NULL }
-};
+ { ::onc::vpn::kAutoConnect, shill::kAutoConnectProperty},
+ { ::onc::vpn::kHost, shill::kProviderHostProperty},
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::vpn::kType, shill::kProviderTypeProperty },
+ {NULL}};
const FieldTranslationEntry wifi_fields[] = {
- { wifi::kAutoConnect, shill::kAutoConnectProperty },
- { wifi::kBSSID, shill::kWifiBSsid },
- { wifi::kFrequency, shill::kWifiFrequency },
- { wifi::kFrequencyList, shill::kWifiFrequencyListProperty },
- { wifi::kHiddenSSID, shill::kWifiHiddenSsid },
- { wifi::kPassphrase, shill::kPassphraseProperty },
- { wifi::kSSID, shill::kSSIDProperty },
- // This field is converted during translation, see onc_translator_*.
- // { wifi::kSecurity, shill::kSecurityProperty },
- { wifi::kSignalStrength, shill::kSignalStrengthProperty },
- { NULL }
-};
+ { ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty},
+ { ::onc::wifi::kBSSID, shill::kWifiBSsid},
+ { ::onc::wifi::kFrequency, shill::kWifiFrequency},
+ { ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty},
+ { ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid},
+ { ::onc::wifi::kPassphrase, shill::kPassphraseProperty},
+ { ::onc::wifi::kSSID, shill::kSSIDProperty},
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::wifi::kSecurity, shill::kSecurityProperty },
+ { ::onc::wifi::kSignalStrength, shill::kSignalStrengthProperty},
+ {NULL}};
const FieldTranslationEntry cellular_apn_fields[] = {
- { cellular_apn::kName, shill::kApnProperty },
- { cellular_apn::kUsername, shill::kApnUsernameProperty },
- { cellular_apn::kPassword, shill::kApnPasswordProperty },
- { NULL }
-};
+ { ::onc::cellular_apn::kName, shill::kApnProperty},
+ { ::onc::cellular_apn::kUsername, shill::kApnUsernameProperty},
+ { ::onc::cellular_apn::kPassword, shill::kApnPasswordProperty},
+ {NULL}};
const FieldTranslationEntry cellular_provider_fields[] = {
- { cellular_provider::kCode, shill::kOperatorCodeKey },
- { cellular_provider::kCountry, shill::kOperatorCountryKey },
- { cellular_provider::kName, shill::kOperatorNameKey },
- { NULL }
-};
+ { ::onc::cellular_provider::kCode, shill::kOperatorCodeKey},
+ { ::onc::cellular_provider::kCountry, shill::kOperatorCountryKey},
+ { ::onc::cellular_provider::kName, shill::kOperatorNameKey},
+ {NULL}};
const FieldTranslationEntry cellular_fields[] = {
- { cellular::kActivateOverNonCellularNetwork,
- shill::kActivateOverNonCellularNetworkProperty },
- { cellular::kActivationState, shill::kActivationStateProperty },
- { cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty },
- { cellular::kCarrier, shill::kCarrierProperty },
- { cellular::kESN, shill::kEsnProperty },
- { cellular::kFamily, shill::kTechnologyFamilyProperty },
- { cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty },
- { cellular::kFoundNetworks, shill::kFoundNetworksProperty },
- { cellular::kHardwareRevision, shill::kHardwareRevisionProperty },
- { cellular::kICCID, shill::kIccidProperty },
- { cellular::kIMEI, shill::kImeiProperty },
- { cellular::kIMSI, shill::kImsiProperty },
- { cellular::kManufacturer, shill::kManufacturerProperty },
- { cellular::kMDN, shill::kMdnProperty },
- { cellular::kMEID, shill::kMeidProperty },
- { cellular::kMIN, shill::kMinProperty },
- { cellular::kModelID, shill::kModelIDProperty },
- { cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty },
- { cellular::kPRLVersion, shill::kPRLVersionProperty },
- { cellular::kProviderRequiresRoaming,
- shill::kProviderRequiresRoamingProperty },
- { cellular::kRoamingState, shill::kRoamingStateProperty },
- { cellular::kSelectedNetwork, shill::kSelectedNetworkProperty },
- { cellular::kSIMLockStatus, shill::kSIMLockStatusProperty },
- { cellular::kSIMPresent, shill::kSIMPresentProperty },
- { cellular::kSupportedCarriers, shill::kSupportedCarriersProperty },
- { cellular::kSupportNetworkScan, shill::kSupportNetworkScanProperty },
- { NULL }
-};
+ { ::onc::cellular::kActivateOverNonCellularNetwork,
+ shill::kActivateOverNonCellularNetworkProperty},
+ { ::onc::cellular::kActivationState, shill::kActivationStateProperty},
+ { ::onc::cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty},
+ { ::onc::cellular::kCarrier, shill::kCarrierProperty},
+ { ::onc::cellular::kESN, shill::kEsnProperty},
+ { ::onc::cellular::kFamily, shill::kTechnologyFamilyProperty},
+ { ::onc::cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty},
+ { ::onc::cellular::kFoundNetworks, shill::kFoundNetworksProperty},
+ { ::onc::cellular::kHardwareRevision, shill::kHardwareRevisionProperty},
+ { ::onc::cellular::kICCID, shill::kIccidProperty},
+ { ::onc::cellular::kIMEI, shill::kImeiProperty},
+ { ::onc::cellular::kIMSI, shill::kImsiProperty},
+ { ::onc::cellular::kManufacturer, shill::kManufacturerProperty},
+ { ::onc::cellular::kMDN, shill::kMdnProperty},
+ { ::onc::cellular::kMEID, shill::kMeidProperty},
+ { ::onc::cellular::kMIN, shill::kMinProperty},
+ { ::onc::cellular::kModelID, shill::kModelIDProperty},
+ { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty},
+ { ::onc::cellular::kPRLVersion, shill::kPRLVersionProperty},
+ { ::onc::cellular::kProviderRequiresRoaming,
+ shill::kProviderRequiresRoamingProperty},
+ { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty},
+ { ::onc::cellular::kSelectedNetwork, shill::kSelectedNetworkProperty},
+ { ::onc::cellular::kSIMLockStatus, shill::kSIMLockStatusProperty},
+ { ::onc::cellular::kSIMPresent, shill::kSIMPresentProperty},
+ { ::onc::cellular::kSupportedCarriers, shill::kSupportedCarriersProperty},
+ { ::onc::cellular::kSupportNetworkScan, shill::kSupportNetworkScanProperty},
+ {NULL}};
const FieldTranslationEntry network_fields[] = {
- // Shill doesn't allow setting the name for non-VPN networks.
- // This field is conditionally translated, see onc_translator_*.
- // { network_config::kName, shill::kNameProperty },
- { network_config::kGUID, shill::kGuidProperty },
- // This field is converted during translation, see onc_translator_*.
- // { network_config::kType, shill::kTypeProperty },
-
- // This field is converted during translation, see
- // onc_translator_shill_to_onc.cc. It is only converted when going from
- // Shill->ONC, and ignored otherwise.
- // { network_config::kConnectionState, shill::kStateProperty },
- { NULL }
-};
+ // Shill doesn't allow setting the name for non-VPN networks.
+ // This field is conditionally translated, see onc_translator_*.
+ // { ::onc::network_config::kName, shill::kNameProperty },
+ { ::onc::network_config::kGUID, shill::kGuidProperty},
+ // This field is converted during translation, see onc_translator_*.
+ // { ::onc::network_config::kType, shill::kTypeProperty },
+
+ // This field is converted during translation, see
+ // onc_translator_shill_to_onc.cc. It is only converted when going from
+ // Shill->ONC, and ignored otherwise.
+ // { ::onc::network_config::kConnectionState, shill::kStateProperty },
+ {NULL}};
struct OncValueTranslationEntry {
const OncValueSignature* onc_signature;
@@ -212,54 +203,46 @@ const NestedShillDictionaryEntry nested_shill_dictionaries[] = {
} // namespace
const StringTranslationEntry kNetworkTypeTable[] = {
- // This mapping is ensured in the translation code.
- // { network_type::kEthernet, shill::kTypeEthernet },
- // { network_type::kEthernet, shill::kTypeEthernetEap },
- { network_type::kWiFi, shill::kTypeWifi },
- { network_type::kCellular, shill::kTypeCellular },
- { network_type::kVPN, shill::kTypeVPN },
- { NULL }
-};
+ // This mapping is ensured in the translation code.
+ // { network_type::kEthernet, shill::kTypeEthernet },
+ // { network_type::kEthernet, shill::kTypeEthernetEap },
+ { ::onc::network_type::kWiFi, shill::kTypeWifi},
+ { ::onc::network_type::kCellular, shill::kTypeCellular},
+ { ::onc::network_type::kVPN, shill::kTypeVPN},
+ {NULL}};
const StringTranslationEntry kVPNTypeTable[] = {
- { vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec },
- { vpn::kOpenVPN, shill::kProviderOpenVpn },
- { NULL }
-};
+ { ::onc::vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec},
+ { ::onc::vpn::kOpenVPN, shill::kProviderOpenVpn}, {NULL}};
// The first matching line is chosen.
const StringTranslationEntry kWiFiSecurityTable[] = {
- { wifi::kNone, shill::kSecurityNone },
- { wifi::kWEP_PSK, shill::kSecurityWep },
- { wifi::kWPA_PSK, shill::kSecurityPsk },
- { wifi::kWPA_EAP, shill::kSecurity8021x },
- { wifi::kWPA_PSK, shill::kSecurityRsn },
- { wifi::kWPA_PSK, shill::kSecurityWpa },
- { NULL }
-};
+ { ::onc::wifi::kNone, shill::kSecurityNone},
+ { ::onc::wifi::kWEP_PSK, shill::kSecurityWep},
+ { ::onc::wifi::kWPA_PSK, shill::kSecurityPsk},
+ { ::onc::wifi::kWPA_EAP, shill::kSecurity8021x},
+ { ::onc::wifi::kWPA_PSK, shill::kSecurityRsn},
+ { ::onc::wifi::kWPA_PSK, shill::kSecurityWpa},
+ {NULL}};
const StringTranslationEntry kEAPOuterTable[] = {
- { eap::kPEAP, shill::kEapMethodPEAP },
- { eap::kEAP_TLS, shill::kEapMethodTLS },
- { eap::kEAP_TTLS, shill::kEapMethodTTLS },
- { eap::kLEAP, shill::kEapMethodLEAP },
- { NULL }
-};
+ { ::onc::eap::kPEAP, shill::kEapMethodPEAP},
+ { ::onc::eap::kEAP_TLS, shill::kEapMethodTLS},
+ { ::onc::eap::kEAP_TTLS, shill::kEapMethodTTLS},
+ { ::onc::eap::kLEAP, shill::kEapMethodLEAP},
+ {NULL}};
// Translation of the EAP.Inner field in case of EAP.Outer == PEAP
const StringTranslationEntry kEAP_PEAP_InnerTable[] = {
- { eap::kMD5, shill::kEapPhase2AuthPEAPMD5 },
- { eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2 },
- { NULL }
-};
+ { ::onc::eap::kMD5, shill::kEapPhase2AuthPEAPMD5},
+ { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2}, {NULL}};
// Translation of the EAP.Inner field in case of EAP.Outer == TTLS
const StringTranslationEntry kEAP_TTLS_InnerTable[] = {
- { eap::kMD5, shill::kEapPhase2AuthTTLSMD5 },
- { eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2 },
- { eap::kPAP, shill::kEapPhase2AuthTTLSPAP },
- { NULL }
-};
+ { ::onc::eap::kMD5, shill::kEapPhase2AuthTTLSMD5},
+ { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2},
+ { ::onc::eap::kPAP, shill::kEapPhase2AuthTTLSPAP},
+ {NULL}};
const FieldTranslationEntry* GetFieldTranslationTable(
const OncValueSignature& onc_signature) {
diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc
index f3ac1fc..c2ba0e8 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -16,9 +16,9 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translation_tables.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -103,11 +103,11 @@ void LocalTranslator::TranslateFields() {
void LocalTranslator::TranslateEthernet() {
std::string authentication;
- onc_object_->GetStringWithoutPathExpansion(ethernet::kAuthentication,
+ onc_object_->GetStringWithoutPathExpansion(::onc::ethernet::kAuthentication,
&authentication);
const char* shill_type = shill::kTypeEthernet;
- if (authentication == ethernet::k8021X)
+ if (authentication == ::onc::ethernet::k8021X)
shill_type = shill::kTypeEthernetEap;
shill_dictionary_->SetStringWithoutPathExpansion(shill::kTypeProperty,
shill_type);
@@ -120,7 +120,7 @@ void LocalTranslator::TranslateOpenVPN() {
// Copy only the first entry if existing.
const base::ListValue* certKUs = NULL;
std::string certKU;
- if (onc_object_->GetListWithoutPathExpansion(openvpn::kRemoteCertKU,
+ if (onc_object_->GetListWithoutPathExpansion(::onc::openvpn::kRemoteCertKU,
&certKUs) &&
certKUs->GetString(0, &certKU)) {
shill_dictionary_->SetStringWithoutPathExpansion(
@@ -130,9 +130,9 @@ void LocalTranslator::TranslateOpenVPN() {
for (base::DictionaryValue::Iterator it(*onc_object_); !it.IsAtEnd();
it.Advance()) {
scoped_ptr<base::Value> translated;
- if (it.key() == vpn::kSaveCredentials ||
- it.key() == openvpn::kRemoteCertKU ||
- it.key() == openvpn::kServerCAPEMs) {
+ if (it.key() == ::onc::vpn::kSaveCredentials ||
+ it.key() == ::onc::openvpn::kRemoteCertKU ||
+ it.key() == ::onc::openvpn::kServerCAPEMs) {
translated.reset(it.value().DeepCopy());
} else {
// Shill wants all Provider/VPN fields to be strings.
@@ -144,7 +144,7 @@ void LocalTranslator::TranslateOpenVPN() {
void LocalTranslator::TranslateVPN() {
std::string type;
- onc_object_->GetStringWithoutPathExpansion(vpn::kType, &type);
+ onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &type);
TranslateWithTableAndSet(type, kVPNTypeTable, shill::kProviderTypeProperty);
CopyFieldsAccordingToSignature();
@@ -152,7 +152,7 @@ void LocalTranslator::TranslateVPN() {
void LocalTranslator::TranslateWiFi() {
std::string security;
- onc_object_->GetStringWithoutPathExpansion(wifi::kSecurity, &security);
+ onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
TranslateWithTableAndSet(security, kWiFiSecurityTable,
shill::kSecurityProperty);
@@ -164,19 +164,20 @@ void LocalTranslator::TranslateWiFi() {
void LocalTranslator::TranslateEAP() {
std::string outer;
- onc_object_->GetStringWithoutPathExpansion(eap::kOuter, &outer);
+ onc_object_->GetStringWithoutPathExpansion(::onc::eap::kOuter, &outer);
TranslateWithTableAndSet(outer, kEAPOuterTable, shill::kEapMethodProperty);
// Translate the inner protocol only for outer tunneling protocols.
- if (outer == eap::kPEAP || outer == eap::kEAP_TTLS) {
+ if (outer == ::onc::eap::kPEAP || outer == ::onc::eap::kEAP_TTLS) {
// In ONC the Inner protocol defaults to "Automatic".
- std::string inner = eap::kAutomatic;
+ std::string inner = ::onc::eap::kAutomatic;
// ONC's Inner == "Automatic" translates to omitting the Phase2 property in
// Shill.
- onc_object_->GetStringWithoutPathExpansion(eap::kInner, &inner);
- if (inner != eap::kAutomatic) {
+ onc_object_->GetStringWithoutPathExpansion(::onc::eap::kInner, &inner);
+ if (inner != ::onc::eap::kAutomatic) {
const StringTranslationEntry* table =
- outer == eap::kPEAP ? kEAP_PEAP_InnerTable : kEAP_TTLS_InnerTable;
+ outer == ::onc::eap::kPEAP ? kEAP_PEAP_InnerTable :
+ kEAP_TTLS_InnerTable;
TranslateWithTableAndSet(inner, table, shill::kEapPhase2AuthProperty);
}
}
@@ -186,16 +187,18 @@ void LocalTranslator::TranslateEAP() {
void LocalTranslator::TranslateNetworkConfiguration() {
std::string type;
- onc_object_->GetStringWithoutPathExpansion(network_config::kType, &type);
+ onc_object_->GetStringWithoutPathExpansion(::onc::network_config::kType,
+ &type);
// Set the type except for Ethernet which is set in TranslateEthernet.
- if (type != network_type::kEthernet)
+ if (type != ::onc::network_type::kEthernet)
TranslateWithTableAndSet(type, kNetworkTypeTable, shill::kTypeProperty);
// Shill doesn't allow setting the name for non-VPN networks.
- if (type == network_type::kVPN) {
+ if (type == ::onc::network_type::kVPN) {
std::string name;
- onc_object_->GetStringWithoutPathExpansion(network_config::kName, &name);
+ onc_object_->GetStringWithoutPathExpansion(::onc::network_config::kName,
+ &name);
shill_dictionary_->SetStringWithoutPathExpansion(shill::kNameProperty,
name);
}
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index 124db9f..ed1e643 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -12,9 +12,9 @@
#include "base/logging.h"
#include "base/values.h"
#include "chromeos/network/network_state.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translation_tables.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -130,10 +130,10 @@ void ShillToONCTranslator::TranslateEthernet() {
std::string shill_network_type;
shill_dictionary_->GetStringWithoutPathExpansion(shill::kTypeProperty,
&shill_network_type);
- const char* onc_auth = ethernet::kNone;
+ const char* onc_auth = ::onc::ethernet::kNone;
if (shill_network_type == shill::kTypeEthernetEap)
- onc_auth = ethernet::k8021X;
- onc_object_->SetStringWithoutPathExpansion(ethernet::kAuthentication,
+ onc_auth = ::onc::ethernet::k8021X;
+ onc_object_->SetStringWithoutPathExpansion(::onc::ethernet::kAuthentication,
onc_auth);
}
@@ -145,16 +145,16 @@ void ShillToONCTranslator::TranslateOpenVPN() {
shill::kOpenVPNRemoteCertKUProperty, &certKU)) {
scoped_ptr<base::ListValue> certKUs(new base::ListValue);
certKUs->AppendString(certKU);
- onc_object_->SetWithoutPathExpansion(openvpn::kRemoteCertKU,
+ onc_object_->SetWithoutPathExpansion(::onc::openvpn::kRemoteCertKU,
certKUs.release());
}
for (const OncFieldSignature* field_signature = onc_signature_->fields;
field_signature->onc_field_name != NULL; ++field_signature) {
const std::string& onc_field_name = field_signature->onc_field_name;
- if (onc_field_name == vpn::kSaveCredentials ||
- onc_field_name == openvpn::kRemoteCertKU ||
- onc_field_name == openvpn::kServerCAPEMs) {
+ if (onc_field_name == ::onc::vpn::kSaveCredentials ||
+ onc_field_name == ::onc::openvpn::kRemoteCertKU ||
+ onc_field_name == ::onc::openvpn::kServerCAPEMs) {
CopyProperty(field_signature);
continue;
}
@@ -197,16 +197,16 @@ void ShillToONCTranslator::TranslateOpenVPN() {
}
void ShillToONCTranslator::TranslateVPN() {
- TranslateWithTableAndSet(shill::kProviderTypeProperty, kVPNTypeTable,
- vpn::kType);
+ TranslateWithTableAndSet(
+ shill::kProviderTypeProperty, kVPNTypeTable, ::onc::vpn::kType);
CopyPropertiesAccordingToSignature();
std::string vpn_type;
- if (onc_object_->GetStringWithoutPathExpansion(vpn::kType,
+ if (onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType,
&vpn_type)) {
- if (vpn_type == vpn::kTypeL2TP_IPsec) {
- TranslateAndAddNestedObject(vpn::kIPsec);
- TranslateAndAddNestedObject(vpn::kL2TP);
+ if (vpn_type == ::onc::vpn::kTypeL2TP_IPsec) {
+ TranslateAndAddNestedObject(::onc::vpn::kIPsec);
+ TranslateAndAddNestedObject(::onc::vpn::kL2TP);
} else {
TranslateAndAddNestedObject(vpn_type);
}
@@ -214,8 +214,8 @@ void ShillToONCTranslator::TranslateVPN() {
}
void ShillToONCTranslator::TranslateWiFiWithState() {
- TranslateWithTableAndSet(shill::kSecurityProperty, kWiFiSecurityTable,
- wifi::kSecurity);
+ TranslateWithTableAndSet(
+ shill::kSecurityProperty, kWiFiSecurityTable, ::onc::wifi::kSecurity);
CopyPropertiesAccordingToSignature();
}
@@ -224,11 +224,11 @@ void ShillToONCTranslator::TranslateCellularWithState() {
const base::DictionaryValue* dictionary = NULL;
if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
shill::kServingOperatorProperty, &dictionary)) {
- TranslateAndAddNestedObject(cellular::kServingOperator, *dictionary);
+ TranslateAndAddNestedObject(::onc::cellular::kServingOperator, *dictionary);
}
if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
shill::kCellularApnProperty, &dictionary)) {
- TranslateAndAddNestedObject(cellular::kAPN, *dictionary);
+ TranslateAndAddNestedObject(::onc::cellular::kAPN, *dictionary);
}
}
@@ -238,14 +238,14 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
std::string shill_network_type;
shill_dictionary_->GetStringWithoutPathExpansion(shill::kTypeProperty,
&shill_network_type);
- std::string onc_network_type = network_type::kEthernet;
+ std::string onc_network_type = ::onc::network_type::kEthernet;
if (shill_network_type != shill::kTypeEthernet &&
shill_network_type != shill::kTypeEthernetEap) {
TranslateStringToONC(
kNetworkTypeTable, shill_network_type, &onc_network_type);
}
if (!onc_network_type.empty()) {
- onc_object_->SetStringWithoutPathExpansion(network_config::kType,
+ onc_object_->SetStringWithoutPathExpansion(::onc::network_config::kType,
onc_network_type);
TranslateAndAddNestedObject(onc_network_type);
}
@@ -255,19 +255,20 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
std::string name;
shill_dictionary_->GetStringWithoutPathExpansion(shill::kNameProperty,
&name);
- onc_object_->SetStringWithoutPathExpansion(network_config::kName, name);
+ onc_object_->SetStringWithoutPathExpansion(::onc::network_config::kName,
+ name);
std::string state;
if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kStateProperty,
&state)) {
- std::string onc_state = connection_state::kNotConnected;
+ std::string onc_state = ::onc::connection_state::kNotConnected;
if (NetworkState::StateIsConnected(state)) {
- onc_state = connection_state::kConnected;
+ onc_state = ::onc::connection_state::kConnected;
} else if (NetworkState::StateIsConnecting(state)) {
- onc_state = connection_state::kConnecting;
+ onc_state = ::onc::connection_state::kConnecting;
}
- onc_object_->SetStringWithoutPathExpansion(network_config::kConnectionState,
- onc_state);
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::network_config::kConnectionState, onc_state);
}
}
diff --git a/chromeos/network/onc/onc_translator_unittest.cc b/chromeos/network/onc/onc_translator_unittest.cc
index 12f952f..c81aaa6 100644
--- a/chromeos/network/onc/onc_translator_unittest.cc
+++ b/chromeos/network/onc/onc_translator_unittest.cc
@@ -6,9 +6,9 @@
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_test_utils.h"
+#include "components/onc/onc_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc
index a01e136..75d9e52 100644
--- a/chromeos/network/onc/onc_utils.cc
+++ b/chromeos/network/onc/onc_utils.cc
@@ -24,6 +24,8 @@
#define ONC_LOG_WARNING(message) NET_LOG_WARNING("ONC", message)
#define ONC_LOG_ERROR(message) NET_LOG_ERROR("ONC", message)
+using namespace ::onc;
+
namespace chromeos {
namespace onc {
diff --git a/chromeos/network/onc/onc_utils.h b/chromeos/network/onc/onc_utils.h
index 2dc8783..e36f97a 100644
--- a/chromeos/network/onc/onc_utils.h
+++ b/chromeos/network/onc/onc_utils.h
@@ -13,7 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -49,7 +49,7 @@ CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt(
const base::DictionaryValue& onc);
// For logging only: strings not user facing.
-CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source);
+CHROMEOS_EXPORT std::string GetSourceAsString(::onc::ONCSource source);
// Used for string expansion with function ExpandStringInOncObject(...).
class CHROMEOS_EXPORT StringSubstitution {
@@ -97,7 +97,7 @@ CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> MaskCredentialsInOncObject(
// output lists and should be further processed by the caller.
CHROMEOS_EXPORT bool ParseAndValidateOncForImport(
const std::string& onc_blob,
- ONCSource onc_source,
+ ::onc::ONCSource onc_source,
const std::string& passphrase,
base::ListValue* network_configs,
base::ListValue* certificates);
diff --git a/chromeos/network/onc/onc_utils_unittest.cc b/chromeos/network/onc/onc_utils_unittest.cc
index dc6d4d4..b29398b 100644
--- a/chromeos/network/onc/onc_utils_unittest.cc
+++ b/chromeos/network/onc/onc_utils_unittest.cc
@@ -60,9 +60,9 @@ class StringSubstitutionStub : public StringSubstitution {
StringSubstitutionStub() {}
virtual bool GetSubstitute(const std::string& placeholder,
std::string* substitute) const OVERRIDE {
- if (placeholder == substitutes::kLoginIDField)
+ if (placeholder == ::onc::substitutes::kLoginIDField)
*substitute = kLoginId;
- else if (placeholder == substitutes::kEmailField)
+ else if (placeholder ==::onc::substitutes::kEmailField)
*substitute = kLoginEmail;
else
return false;
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index 0d92b0a..cb2d4b4 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -12,8 +12,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
namespace onc {
@@ -54,7 +54,7 @@ Validator::Validator(
error_on_wrong_recommended_(error_on_wrong_recommended),
error_on_missing_field_(error_on_missing_field),
managed_onc_(managed_onc),
- onc_source_(ONC_SOURCE_NONE) {
+ onc_source_(::onc::ONC_SOURCE_NONE) {
}
Validator::~Validator() {
@@ -239,7 +239,7 @@ bool Validator::ValidateRecommendedField(
scoped_ptr<base::ListValue> recommended;
scoped_ptr<base::Value> recommended_value;
// This remove passes ownership to |recommended_value|.
- if (!result->RemoveWithoutPathExpansion(onc::kRecommended,
+ if (!result->RemoveWithoutPathExpansion(::onc::kRecommended,
&recommended_value)) {
return true;
}
@@ -251,7 +251,8 @@ bool Validator::ValidateRecommendedField(
if (!managed_onc_) {
error_or_warning_found_ = true;
- LOG(WARNING) << MessageHeader() << "Found the field '" << onc::kRecommended
+ LOG(WARNING) << MessageHeader() << "Found the field '"
+ << ::onc::kRecommended
<< "' in an unmanaged ONC. Removing it.";
return true;
}
@@ -281,7 +282,7 @@ bool Validator::ValidateRecommendedField(
if (found_error) {
error_or_warning_found_ = true;
- path_.push_back(onc::kRecommended);
+ path_.push_back(::onc::kRecommended);
std::string message = MessageHeader() + "The " + error_cause +
" field '" + field_name + "' cannot be recommended.";
path_.pop_back();
@@ -297,7 +298,7 @@ bool Validator::ValidateRecommendedField(
repaired_recommended->Append((*it)->DeepCopy());
}
- result->Set(onc::kRecommended, repaired_recommended.release());
+ result->Set(::onc::kRecommended, repaired_recommended.release());
return true;
}
@@ -387,8 +388,8 @@ bool Validator::RequireField(const base::DictionaryValue& dict,
// Prohibit certificate patterns for device policy ONC so that an unmanaged user
// won't have a certificate presented for them involuntarily.
bool Validator::CertPatternInDevicePolicy(const std::string& cert_type) {
- if (cert_type == certificate::kPattern &&
- onc_source_ == ONC_SOURCE_DEVICE_POLICY) {
+ if (cert_type == ::onc::certificate::kPattern &&
+ onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY) {
error_or_warning_found_ = true;
LOG(ERROR) << MessageHeader() << "Client certificate patterns are "
<< "prohibited in ONC device policies.";
@@ -400,7 +401,7 @@ bool Validator::CertPatternInDevicePolicy(const std::string& cert_type) {
bool Validator::ValidateToplevelConfiguration(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::toplevel_config;
+ using namespace ::onc::toplevel_config;
static const char* kValidTypes[] = { kUnencryptedConfiguration,
kEncryptedConfiguration,
@@ -434,12 +435,12 @@ bool Validator::ValidateToplevelConfiguration(
bool Validator::ValidateNetworkConfiguration(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::network_config;
+ using namespace ::onc::network_config;
- static const char* kValidTypes[] = { network_type::kEthernet,
- network_type::kVPN,
- network_type::kWiFi,
- network_type::kCellular,
+ static const char* kValidTypes[] = { ::onc::network_type::kEthernet,
+ ::onc::network_type::kVPN,
+ ::onc::network_type::kWiFi,
+ ::onc::network_type::kCellular,
NULL };
if (FieldExistsAndHasNoValidValue(*result, kType, kValidTypes) ||
FieldExistsAndIsEmpty(*result, kGUID)) {
@@ -449,7 +450,7 @@ bool Validator::ValidateNetworkConfiguration(
bool allRequiredExist = RequireField(*result, kGUID);
bool remove = false;
- result->GetBooleanWithoutPathExpansion(kRemove, &remove);
+ result->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove);
if (!remove) {
allRequiredExist &= RequireField(*result, kName);
allRequiredExist &= RequireField(*result, kType);
@@ -459,23 +460,25 @@ bool Validator::ValidateNetworkConfiguration(
// Prohibit anything but WiFi and Ethernet for device-level policy (which
// corresponds to shared networks). See also http://crosbug.com/28741.
- if (onc_source_ == ONC_SOURCE_DEVICE_POLICY &&
- type != network_type::kWiFi &&
- type != network_type::kEthernet) {
+ if (onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY &&
+ type != ::onc::network_type::kWiFi &&
+ type != ::onc::network_type::kEthernet) {
error_or_warning_found_ = true;
LOG(ERROR) << MessageHeader() << "Networks of type '"
<< type << "' are prohibited in ONC device policies.";
return false;
}
- if (type == network_type::kWiFi)
- allRequiredExist &= RequireField(*result, network_config::kWiFi);
- else if (type == network_type::kEthernet)
- allRequiredExist &= RequireField(*result, network_config::kEthernet);
- else if (type == network_type::kCellular)
- allRequiredExist &= RequireField(*result, network_config::kCellular);
- else if (type == network_type::kVPN)
- allRequiredExist &= RequireField(*result, network_config::kVPN);
+ if (type == ::onc::network_type::kWiFi)
+ allRequiredExist &= RequireField(*result, ::onc::network_config::kWiFi);
+ else if (type == ::onc::network_type::kEthernet)
+ allRequiredExist &= RequireField(*result,
+ ::onc::network_config::kEthernet);
+ else if (type == ::onc::network_type::kCellular)
+ allRequiredExist &= RequireField(*result,
+ ::onc::network_config::kCellular);
+ else if (type == ::onc::network_type::kVPN)
+ allRequiredExist &= RequireField(*result, ::onc::network_config::kVPN);
else if (!type.empty())
NOTREACHED();
}
@@ -486,7 +489,7 @@ bool Validator::ValidateNetworkConfiguration(
bool Validator::ValidateEthernet(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::ethernet;
+ using namespace ::onc::ethernet;
static const char* kValidAuthentications[] = { kNone, k8021X, NULL };
if (FieldExistsAndHasNoValidValue(*result, kAuthentication,
@@ -506,14 +509,15 @@ bool Validator::ValidateEthernet(
bool Validator::ValidateIPConfig(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::ipconfig;
+ using namespace ::onc::ipconfig;
static const char* kValidTypes[] = { kIPv4, kIPv6, NULL };
- if (FieldExistsAndHasNoValidValue(*result, ipconfig::kType, kValidTypes))
+ if (FieldExistsAndHasNoValidValue(*result, ::onc::ipconfig::kType,
+ kValidTypes))
return false;
std::string type;
- result->GetStringWithoutPathExpansion(ipconfig::kType, &type);
+ result->GetStringWithoutPathExpansion(::onc::ipconfig::kType, &type);
int lower_bound = 1;
// In case of missing type, choose higher upper_bound.
int upper_bound = (type == kIPv4) ? 32 : 128;
@@ -524,7 +528,7 @@ bool Validator::ValidateIPConfig(
bool allRequiredExist = RequireField(*result, kIPAddress) &
RequireField(*result, kRoutingPrefix) &
- RequireField(*result, ipconfig::kType);
+ RequireField(*result, ::onc::ipconfig::kType);
return !error_on_missing_field_ || allRequiredExist;
}
@@ -532,7 +536,7 @@ bool Validator::ValidateIPConfig(
bool Validator::ValidateWiFi(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::wifi;
+ using namespace ::onc::wifi;
static const char* kValidSecurities[] =
{ kNone, kWEP_PSK, kWEP_8021X, kWPA_PSK, kWPA_EAP, NULL };
@@ -555,16 +559,16 @@ bool Validator::ValidateWiFi(
bool Validator::ValidateVPN(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace vpn;
+ using namespace ::onc::vpn;
static const char* kValidTypes[] =
{ kIPsec, kTypeL2TP_IPsec, kOpenVPN, NULL };
- if (FieldExistsAndHasNoValidValue(*result, vpn::kType, kValidTypes))
+ if (FieldExistsAndHasNoValidValue(*result, ::onc::vpn::kType, kValidTypes))
return false;
- bool allRequiredExist = RequireField(*result, vpn::kType);
+ bool allRequiredExist = RequireField(*result, ::onc::vpn::kType);
std::string type;
- result->GetStringWithoutPathExpansion(vpn::kType, &type);
+ result->GetStringWithoutPathExpansion(::onc::vpn::kType, &type);
if (type == kOpenVPN) {
allRequiredExist &= RequireField(*result, kOpenVPN);
} else if (type == kIPsec) {
@@ -580,15 +584,15 @@ bool Validator::ValidateVPN(
bool Validator::ValidateIPsec(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::ipsec;
- using namespace onc::certificate;
+ using namespace ::onc::ipsec;
+ using namespace ::onc::certificate;
static const char* kValidAuthentications[] = { kPSK, kCert, NULL };
static const char* kValidCertTypes[] = { kRef, kPattern, NULL };
// Using strict bit-wise OR to check all conditions.
if (FieldExistsAndHasNoValidValue(*result, kAuthenticationType,
kValidAuthentications) |
- FieldExistsAndHasNoValidValue(*result, vpn::kClientCertType,
+ FieldExistsAndHasNoValidValue(*result, ::onc::vpn::kClientCertType,
kValidCertTypes)) {
return false;
}
@@ -598,19 +602,20 @@ bool Validator::ValidateIPsec(
std::string auth;
result->GetStringWithoutPathExpansion(kAuthenticationType, &auth);
if (auth == kCert) {
- allRequiredExist &= RequireField(*result, vpn::kClientCertType) &
+ allRequiredExist &= RequireField(*result, ::onc::vpn::kClientCertType) &
RequireField(*result, kServerCARef);
}
std::string cert_type;
- result->GetStringWithoutPathExpansion(vpn::kClientCertType, &cert_type);
+ result->GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
+ &cert_type);
if (CertPatternInDevicePolicy(cert_type))
return false;
if (cert_type == kPattern)
- allRequiredExist &= RequireField(*result, vpn::kClientCertPattern);
+ allRequiredExist &= RequireField(*result, ::onc::vpn::kClientCertPattern);
else if (cert_type == kRef)
- allRequiredExist &= RequireField(*result, vpn::kClientCertRef);
+ allRequiredExist &= RequireField(*result, ::onc::vpn::kClientCertRef);
return !error_on_missing_field_ || allRequiredExist;
}
@@ -618,37 +623,38 @@ bool Validator::ValidateIPsec(
bool Validator::ValidateOpenVPN(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::openvpn;
- using namespace onc::certificate;
+ using namespace ::onc::openvpn;
+ using namespace ::onc::certificate;
static const char* kValidAuthRetryValues[] =
- { openvpn::kNone, kInteract, kNoInteract, NULL };
+ { ::onc::openvpn::kNone, kInteract, kNoInteract, NULL };
static const char* kValidCertTypes[] =
- { certificate::kNone, kRef, kPattern, NULL };
+ { ::onc::certificate::kNone, kRef, kPattern, NULL };
static const char* kValidCertTlsValues[] =
- { openvpn::kNone, openvpn::kServer, NULL };
+ { ::onc::openvpn::kNone, ::onc::openvpn::kServer, NULL };
// Using strict bit-wise OR to check all conditions.
if (FieldExistsAndHasNoValidValue(*result, kAuthRetry,
kValidAuthRetryValues) |
- FieldExistsAndHasNoValidValue(*result, vpn::kClientCertType,
+ FieldExistsAndHasNoValidValue(*result, ::onc::vpn::kClientCertType,
kValidCertTypes) |
FieldExistsAndHasNoValidValue(*result, kRemoteCertTLS,
kValidCertTlsValues)) {
return false;
}
- bool allRequiredExist = RequireField(*result, vpn::kClientCertType);
+ bool allRequiredExist = RequireField(*result, ::onc::vpn::kClientCertType);
std::string cert_type;
- result->GetStringWithoutPathExpansion(vpn::kClientCertType, &cert_type);
+ result->GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
+ &cert_type);
if (CertPatternInDevicePolicy(cert_type))
return false;
if (cert_type == kPattern)
- allRequiredExist &= RequireField(*result, vpn::kClientCertPattern);
+ allRequiredExist &= RequireField(*result, ::onc::vpn::kClientCertPattern);
else if (cert_type == kRef)
- allRequiredExist &= RequireField(*result, vpn::kClientCertRef);
+ allRequiredExist &= RequireField(*result, ::onc::vpn::kClientCertRef);
return !error_on_missing_field_ || allRequiredExist;
}
@@ -656,7 +662,7 @@ bool Validator::ValidateOpenVPN(
bool Validator::ValidateCertificatePattern(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::certificate;
+ using namespace ::onc::certificate;
bool allRequiredExist = true;
if (!result->HasKey(kSubject) && !result->HasKey(kIssuer) &&
@@ -677,15 +683,15 @@ bool Validator::ValidateCertificatePattern(
bool Validator::ValidateProxySettings(const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::proxy;
+ using namespace ::onc::proxy;
static const char* kValidTypes[] = { kDirect, kManual, kPAC, kWPAD, NULL };
- if (FieldExistsAndHasNoValidValue(*result, proxy::kType, kValidTypes))
+ if (FieldExistsAndHasNoValidValue(*result, ::onc::proxy::kType, kValidTypes))
return false;
- bool allRequiredExist = RequireField(*result, proxy::kType);
+ bool allRequiredExist = RequireField(*result, ::onc::proxy::kType);
std::string type;
- result->GetStringWithoutPathExpansion(proxy::kType, &type);
+ result->GetStringWithoutPathExpansion(::onc::proxy::kType, &type);
if (type == kManual)
allRequiredExist &= RequireField(*result, kManual);
else if (type == kPAC)
@@ -696,7 +702,7 @@ bool Validator::ValidateProxySettings(const base::DictionaryValue& onc_object,
bool Validator::ValidateProxyLocation(const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::proxy;
+ using namespace ::onc::proxy;
bool allRequiredExist = RequireField(*result, kHost) &
RequireField(*result, kPort);
@@ -706,8 +712,8 @@ bool Validator::ValidateProxyLocation(const base::DictionaryValue& onc_object,
bool Validator::ValidateEAP(const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::eap;
- using namespace onc::certificate;
+ using namespace ::onc::eap;
+ using namespace ::onc::certificate;
static const char* kValidInnerValues[] =
{ kAutomatic, kMD5, kMSCHAPv2, kPAP, NULL };
@@ -742,7 +748,7 @@ bool Validator::ValidateEAP(const base::DictionaryValue& onc_object,
bool Validator::ValidateCertificate(
const base::DictionaryValue& onc_object,
base::DictionaryValue* result) {
- using namespace onc::certificate;
+ using namespace ::onc::certificate;
static const char* kValidTypes[] = { kClient, kServer, kAuthority, NULL };
if (FieldExistsAndHasNoValidValue(*result, kType, kValidTypes) ||
@@ -752,7 +758,7 @@ bool Validator::ValidateCertificate(
std::string type;
result->GetStringWithoutPathExpansion(kType, &type);
- if (onc_source_ == ONC_SOURCE_DEVICE_POLICY &&
+ if (onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY &&
(type == kServer || type == kAuthority)) {
error_or_warning_found_ = true;
LOG(ERROR) << MessageHeader() << "Server and authority certificates are "
@@ -763,7 +769,7 @@ bool Validator::ValidateCertificate(
bool allRequiredExist = RequireField(*result, kGUID);
bool remove = false;
- result->GetBooleanWithoutPathExpansion(kRemove, &remove);
+ result->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove);
if (!remove) {
allRequiredExist &= RequireField(*result, kType);
diff --git a/chromeos/network/onc/onc_validator.h b/chromeos/network/onc/onc_validator.h
index 539224f..ef19260 100644
--- a/chromeos/network/onc/onc_validator.h
+++ b/chromeos/network/onc/onc_validator.h
@@ -10,8 +10,8 @@
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_mapper.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -73,7 +73,7 @@ class CHROMEOS_EXPORT Validator : public Mapper {
// checks:
// - only the network types Wifi and Ethernet are allowed
// - client certificate patterns are disallowed
- void SetOncSource(ONCSource source) {
+ void SetOncSource(::onc::ONCSource source) {
onc_source_ = source;
}
@@ -224,7 +224,7 @@ class CHROMEOS_EXPORT Validator : public Mapper {
const bool error_on_missing_field_;
const bool managed_onc_;
- ONCSource onc_source_;
+ ::onc::ONCSource onc_source_;
// The path of field names and indices to the current value. Indices
// are stored as strings in decimal notation.
diff --git a/chromeos/network/onc/onc_validator_unittest.cc b/chromeos/network/onc/onc_validator_unittest.cc
index 3ddd679..0972685 100644
--- a/chromeos/network/onc/onc_validator_unittest.cc
+++ b/chromeos/network/onc/onc_validator_unittest.cc
@@ -10,10 +10,10 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_test_utils.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "components/onc/onc_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
@@ -30,7 +30,7 @@ class ONCValidatorTest : public ::testing::Test {
scoped_ptr<base::DictionaryValue> onc_object,
const OncValueSignature* signature,
bool managed_onc,
- ONCSource onc_source) {
+ ::onc::ONCSource onc_source) {
scoped_ptr<Validator> validator;
if (strict) {
// Create a strict validator that complains about every error.
@@ -77,7 +77,7 @@ struct OncParams {
OncParams(const std::string& location_of_object,
const OncValueSignature* onc_signature,
bool is_managed_onc,
- ONCSource onc_source = ONC_SOURCE_NONE)
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE)
: location(location_of_object),
signature(onc_signature),
is_managed(is_managed_onc),
@@ -87,7 +87,7 @@ struct OncParams {
std::string location;
const OncValueSignature* signature;
bool is_managed;
- ONCSource onc_source;
+ ::onc::ONCSource onc_source;
};
::std::ostream& operator<<(::std::ostream& os, const OncParams& onc) {
@@ -102,7 +102,7 @@ struct OncParams {
// ONC toplevel object.
TEST_F(ONCValidatorTest, EmptyUnencryptedConfiguration) {
Validate(true, ReadDictionaryFromJson(kEmptyUnencryptedConfiguration),
- &kToplevelConfigurationSignature, false, ONC_SOURCE_NONE);
+ &kToplevelConfigurationSignature, false, ::onc::ONC_SOURCE_NONE);
ExpectValid();
}
@@ -144,7 +144,7 @@ INSTANTIATE_TEST_CASE_P(
OncParams("managed_toplevel_wifi_peap.onc",
&kToplevelConfigurationSignature,
true,
- ONC_SOURCE_DEVICE_POLICY),
+ ::onc::ONC_SOURCE_DEVICE_POLICY),
OncParams("toplevel_wifi_wpa_psk.onc",
&kToplevelConfigurationSignature,
false),
@@ -292,7 +292,7 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair(OncParams("toplevel-with-repairable-networks",
&kToplevelConfigurationSignature,
false,
- ONC_SOURCE_DEVICE_POLICY),
+ ::onc::ONC_SOURCE_DEVICE_POLICY),
RepairParams("", "toplevel-with-repaired-networks"))));
// Strict and liberal validator repair identically.
@@ -318,12 +318,12 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair(OncParams("toplevel-with-vpn",
&kToplevelConfigurationSignature,
false,
- ONC_SOURCE_DEVICE_POLICY),
+ ::onc::ONC_SOURCE_DEVICE_POLICY),
RepairParams("toplevel-empty", "toplevel-empty")),
std::make_pair(OncParams("toplevel-with-server-and-ca-cert",
&kToplevelConfigurationSignature,
true,
- ONC_SOURCE_DEVICE_POLICY),
+ ::onc::ONC_SOURCE_DEVICE_POLICY),
RepairParams("toplevel-server-and-ca-cert-dropped",
"toplevel-server-and-ca-cert-dropped"))));
@@ -362,7 +362,7 @@ INSTANTIATE_TEST_CASE_P(
RepairParams("", "")),
std::make_pair(OncParams("network-with-client-cert-pattern",
&kNetworkConfigurationSignature, true,
- ONC_SOURCE_DEVICE_POLICY),
+ ::onc::ONC_SOURCE_DEVICE_POLICY),
RepairParams("", ""))));
} // namespace onc
diff --git a/chromeos/network/policy_applicator.cc b/chromeos/network/policy_applicator.cc
index 1b6d95f..ce236b0 100644
--- a/chromeos/network/policy_applicator.cc
+++ b/chromeos/network/policy_applicator.cc
@@ -14,11 +14,11 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_profile_client.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translator.h"
#include "chromeos/network/policy_util.h"
#include "chromeos/network/shill_property_util.h"
+#include "components/onc/onc_constants.h"
#include "dbus/object_path.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -110,7 +110,7 @@ void PolicyApplicator::GetEntryCallback(
&onc::kNetworkWithStateSignature));
std::string old_guid;
- if (!onc_part->GetStringWithoutPathExpansion(onc::network_config::kGUID,
+ if (!onc_part->GetStringWithoutPathExpansion(::onc::network_config::kGUID,
&old_guid)) {
VLOG(1) << "Entry " << entry << " of profile " << profile_.ToDebugString()
<< " doesn't contain a GUID.";
@@ -130,8 +130,9 @@ void PolicyApplicator::GetEntryCallback(
}
bool was_managed = !old_guid.empty() && ui_data &&
- (ui_data->onc_source() == onc::ONC_SOURCE_DEVICE_POLICY ||
- ui_data->onc_source() == onc::ONC_SOURCE_USER_POLICY);
+ (ui_data->onc_source() ==
+ ::onc::ONC_SOURCE_DEVICE_POLICY ||
+ ui_data->onc_source() == ::onc::ONC_SOURCE_USER_POLICY);
const base::DictionaryValue* new_policy = NULL;
if (was_managed) {
@@ -148,7 +149,7 @@ void PolicyApplicator::GetEntryCallback(
if (new_policy) {
std::string new_guid;
- new_policy->GetStringWithoutPathExpansion(onc::network_config::kGUID,
+ new_policy->GetStringWithoutPathExpansion(::onc::network_config::kGUID,
&new_guid);
VLOG_IF(1, was_managed && old_guid != new_guid)
@@ -212,16 +213,16 @@ void PolicyApplicator::CreateAndWriteNewShillConfiguration(
// Ethernet (non EAP) settings, like GUID or UIData, cannot be stored per
// user. Abort in that case.
std::string type;
- policy.GetStringWithoutPathExpansion(onc::network_config::kType, &type);
- if (type == onc::network_type::kEthernet &&
+ policy.GetStringWithoutPathExpansion(::onc::network_config::kType, &type);
+ if (type == ::onc::network_type::kEthernet &&
profile_.type() == NetworkProfile::TYPE_USER) {
const base::DictionaryValue* ethernet = NULL;
- policy.GetDictionaryWithoutPathExpansion(onc::network_config::kEthernet,
+ policy.GetDictionaryWithoutPathExpansion(::onc::network_config::kEthernet,
&ethernet);
std::string auth;
- ethernet->GetStringWithoutPathExpansion(onc::ethernet::kAuthentication,
+ ethernet->GetStringWithoutPathExpansion(::onc::ethernet::kAuthentication,
&auth);
- if (auth == onc::ethernet::kNone)
+ if (auth == ::onc::ethernet::kNone)
return;
}
diff --git a/chromeos/network/policy_util.cc b/chromeos/network/policy_util.cc
index b8043a6..0a7526c 100644
--- a/chromeos/network/policy_util.cc
+++ b/chromeos/network/policy_util.cc
@@ -8,13 +8,13 @@
#include "base/values.h"
#include "chromeos/network/network_profile.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_merger.h"
#include "chromeos/network/onc/onc_normalizer.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translator.h"
#include "chromeos/network/onc/onc_utils.h"
#include "chromeos/network/shill_property_util.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -78,45 +78,48 @@ void RemoveFakeCredentials(
bool IsPolicyMatching(const base::DictionaryValue& policy,
const base::DictionaryValue& actual_network) {
std::string policy_type;
- policy.GetStringWithoutPathExpansion(onc::network_config::kType,
+ policy.GetStringWithoutPathExpansion(::onc::network_config::kType,
&policy_type);
std::string actual_network_type;
- actual_network.GetStringWithoutPathExpansion(onc::network_config::kType,
+ actual_network.GetStringWithoutPathExpansion(::onc::network_config::kType,
&actual_network_type);
if (policy_type != actual_network_type)
return false;
- if (actual_network_type == onc::network_type::kEthernet) {
+ if (actual_network_type == ::onc::network_type::kEthernet) {
const base::DictionaryValue* policy_ethernet = NULL;
- policy.GetDictionaryWithoutPathExpansion(onc::network_config::kEthernet,
+ policy.GetDictionaryWithoutPathExpansion(::onc::network_config::kEthernet,
&policy_ethernet);
const base::DictionaryValue* actual_ethernet = NULL;
actual_network.GetDictionaryWithoutPathExpansion(
- onc::network_config::kEthernet, &actual_ethernet);
+ ::onc::network_config::kEthernet, &actual_ethernet);
if (!policy_ethernet || !actual_ethernet)
return false;
std::string policy_auth;
policy_ethernet->GetStringWithoutPathExpansion(
- onc::ethernet::kAuthentication, &policy_auth);
+ ::onc::ethernet::kAuthentication, &policy_auth);
std::string actual_auth;
actual_ethernet->GetStringWithoutPathExpansion(
- onc::ethernet::kAuthentication, &actual_auth);
+ ::onc::ethernet::kAuthentication, &actual_auth);
return policy_auth == actual_auth;
- } else if (actual_network_type == onc::network_type::kWiFi) {
+ } else if (actual_network_type == ::onc::network_type::kWiFi) {
const base::DictionaryValue* policy_wifi = NULL;
- policy.GetDictionaryWithoutPathExpansion(onc::network_config::kWiFi,
+ policy.GetDictionaryWithoutPathExpansion(::onc::network_config::kWiFi,
&policy_wifi);
const base::DictionaryValue* actual_wifi = NULL;
- actual_network.GetDictionaryWithoutPathExpansion(onc::network_config::kWiFi,
- &actual_wifi);
+ actual_network.GetDictionaryWithoutPathExpansion(
+ ::onc::network_config::kWiFi,
+ &actual_wifi);
if (!policy_wifi || !actual_wifi)
return false;
std::string policy_ssid;
- policy_wifi->GetStringWithoutPathExpansion(onc::wifi::kSSID, &policy_ssid);
+ policy_wifi->GetStringWithoutPathExpansion(::onc::wifi::kSSID,
+ &policy_ssid);
std::string actual_ssid;
- actual_wifi->GetStringWithoutPathExpansion(onc::wifi::kSSID, &actual_ssid);
+ actual_wifi->GetStringWithoutPathExpansion(::onc::wifi::kSSID,
+ &actual_ssid);
return (policy_ssid == actual_ssid);
}
return false;
@@ -130,7 +133,7 @@ scoped_ptr<base::DictionaryValue> CreateShillConfiguration(
const base::DictionaryValue* policy,
const base::DictionaryValue* settings) {
scoped_ptr<base::DictionaryValue> effective;
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
if (policy) {
if (profile.type() == NetworkProfile::TYPE_SHARED) {
effective = onc::MergeSettingsAndPoliciesToEffective(
@@ -138,30 +141,30 @@ scoped_ptr<base::DictionaryValue> CreateShillConfiguration(
policy, // device policy
NULL, // no user settings
settings); // shared settings
- onc_source = onc::ONC_SOURCE_DEVICE_POLICY;
+ onc_source = ::onc::ONC_SOURCE_DEVICE_POLICY;
} else if (profile.type() == NetworkProfile::TYPE_USER) {
effective = onc::MergeSettingsAndPoliciesToEffective(
policy, // user policy
NULL, // no device policy
settings, // user settings
NULL); // no shared settings
- onc_source = onc::ONC_SOURCE_USER_POLICY;
+ onc_source = ::onc::ONC_SOURCE_USER_POLICY;
} else {
NOTREACHED();
}
} else if (settings) {
effective.reset(settings->DeepCopy());
// TODO(pneubeck): change to source ONC_SOURCE_USER
- onc_source = onc::ONC_SOURCE_NONE;
+ onc_source = ::onc::ONC_SOURCE_NONE;
} else {
NOTREACHED();
- onc_source = onc::ONC_SOURCE_NONE;
+ onc_source = ::onc::ONC_SOURCE_NONE;
}
RemoveFakeCredentials(onc::kNetworkConfigurationSignature,
effective.get());
- effective->SetStringWithoutPathExpansion(onc::network_config::kGUID, guid);
+ effective->SetStringWithoutPathExpansion(::onc::network_config::kGUID, guid);
// Remove irrelevant fields.
onc::Normalizer normalizer(true /* remove recommended fields */);