summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/DEPS1
-rw-r--r--chrome/browser/chromeos/net/onc_utils.cc71
-rw-r--r--chrome/browser/chromeos/net/onc_utils.h6
-rw-r--r--chrome/browser/chromeos/net/proxy_config_handler.cc4
-rw-r--r--chrome/browser/chromeos/net/proxy_config_handler.h2
-rw-r--r--chrome/browser/chromeos/options/network_property_ui_data.h12
-rw-r--r--chrome/browser/chromeos/options/network_property_ui_data_unittest.cc2
-rw-r--r--chrome/browser/chromeos/options/vpn_config_view.cc28
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc29
-rw-r--r--chrome/browser/chromeos/options/wimax_config_view.cc2
-rw-r--r--chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc32
-rw-r--r--chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h6
-rw-r--r--chrome/browser/chromeos/policy/network_configuration_updater.cc4
-rw-r--r--chrome/browser/chromeos/policy/network_configuration_updater.h6
-rw-r--r--chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc17
-rw-r--r--chrome/browser/chromeos/policy/user_network_configuration_updater.cc2
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.cc8
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.h2
-rw-r--r--chrome/browser/extensions/api/networking_private/DEPS3
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc12
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_apitest.cc2
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc2
-rw-r--r--chrome/browser/ui/webui/net_internals/DEPS3
-rw-r--r--chrome/browser/ui/webui/net_internals/net_internals_ui.cc4
-rw-r--r--chrome/browser/ui/webui/options/chromeos/DEPS3
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc17
-rw-r--r--chrome/browser/ui/webui/options/preferences_browsertest.cc10
-rw-r--r--chrome/chrome_browser_chromeos.gypi1
-rw-r--r--chrome/chrome_browser_extensions.gypi1
-rw-r--r--chrome/chrome_browser_ui.gypi1
-rw-r--r--chromeos/chromeos.gyp4
-rw-r--r--chromeos/docs/OWNERS2
-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.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
-rw-r--r--components/OWNERS6
-rw-r--r--components/components.gyp1
-rw-r--r--components/onc.gypi26
-rw-r--r--components/onc/OWNERS5
-rw-r--r--components/onc/docs/onc_spec.css (renamed from chromeos/docs/onc_spec.css)2
-rw-r--r--components/onc/docs/onc_spec.html (renamed from chromeos/docs/onc_spec.html)0
-rw-r--r--components/onc/docs/onc_spec.js (renamed from chromeos/docs/onc_spec.js)2
-rw-r--r--components/onc/onc_constants.cc (renamed from chromeos/network/onc/onc_constants.cc)7
-rw-r--r--components/onc/onc_constants.h314
-rw-r--r--components/onc/onc_export.h29
76 files changed, 1250 insertions, 1182 deletions
diff --git a/chrome/browser/chromeos/DEPS b/chrome/browser/chromeos/DEPS
index 52ada1a..9eab34c 100644
--- a/chrome/browser/chromeos/DEPS
+++ b/chrome/browser/chromeos/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+components/onc",
"+cros",
"+dbus",
"+device/bluetooth",
diff --git a/chrome/browser/chromeos/net/onc_utils.cc b/chrome/browser/chromeos/net/onc_utils.cc
index a92e2ff..4a52464 100644
--- a/chrome/browser/chromeos/net/onc_utils.cc
+++ b/chrome/browser/chromeos/net/onc_utils.cc
@@ -42,12 +42,12 @@ net::ProxyServer ConvertOncProxyLocationToHostPort(
net::ProxyServer::Scheme default_proxy_scheme,
const base::DictionaryValue& onc_proxy_location) {
std::string host;
- onc_proxy_location.GetStringWithoutPathExpansion(onc::proxy::kHost, &host);
+ onc_proxy_location.GetStringWithoutPathExpansion(::onc::proxy::kHost, &host);
// Parse |host| according to the format [<scheme>"://"]<server>[":"<port>].
net::ProxyServer proxy_server =
net::ProxyServer::FromURI(host, default_proxy_scheme);
int port = 0;
- onc_proxy_location.GetIntegerWithoutPathExpansion(onc::proxy::kPort, &port);
+ onc_proxy_location.GetIntegerWithoutPathExpansion(::onc::proxy::kPort, &port);
// Replace the port parsed from |host| by the provided |port|.
return net::ProxyServer(
@@ -68,13 +68,13 @@ void AppendProxyServerForScheme(
net::ProxyServer::Scheme default_proxy_scheme = net::ProxyServer::SCHEME_HTTP;
std::string url_scheme;
- if (onc_scheme == proxy::kFtp) {
+ if (onc_scheme == ::onc::proxy::kFtp) {
url_scheme = "ftp";
- } else if (onc_scheme == proxy::kHttp) {
+ } else if (onc_scheme == ::onc::proxy::kHttp) {
url_scheme = "http";
- } else if (onc_scheme == proxy::kHttps) {
+ } else if (onc_scheme == ::onc::proxy::kHttps) {
url_scheme = "https";
- } else if (onc_scheme == proxy::kSocks) {
+ } else if (onc_scheme == ::onc::proxy::kSocks) {
default_proxy_scheme = net::ProxyServer::SCHEME_SOCKS4;
url_scheme = "socks";
} else {
@@ -104,35 +104,38 @@ net::ProxyBypassRules ConvertOncExcludeDomainsToBypassRules(
scoped_ptr<base::DictionaryValue> ConvertOncProxySettingsToProxyConfig(
const base::DictionaryValue& onc_proxy_settings) {
std::string type;
- onc_proxy_settings.GetStringWithoutPathExpansion(proxy::kType, &type);
+ onc_proxy_settings.GetStringWithoutPathExpansion(::onc::proxy::kType, &type);
scoped_ptr<DictionaryValue> proxy_dict;
- if (type == proxy::kDirect) {
+ if (type == ::onc::proxy::kDirect) {
proxy_dict.reset(ProxyConfigDictionary::CreateDirect());
- } else if (type == proxy::kWPAD) {
+ } else if (type == ::onc::proxy::kWPAD) {
proxy_dict.reset(ProxyConfigDictionary::CreateAutoDetect());
- } else if (type == proxy::kPAC) {
+ } else if (type == ::onc::proxy::kPAC) {
std::string pac_url;
- onc_proxy_settings.GetStringWithoutPathExpansion(proxy::kPAC, &pac_url);
+ onc_proxy_settings.GetStringWithoutPathExpansion(::onc::proxy::kPAC,
+ &pac_url);
GURL url(pac_url);
DCHECK(url.is_valid())
<< "PAC field is invalid for this ProxySettings.Type";
proxy_dict.reset(ProxyConfigDictionary::CreatePacScript(url.spec(),
false));
- } else if (type == proxy::kManual) {
+ } else if (type == ::onc::proxy::kManual) {
const base::DictionaryValue* manual_dict = NULL;
- onc_proxy_settings.GetDictionaryWithoutPathExpansion(proxy::kManual,
+ onc_proxy_settings.GetDictionaryWithoutPathExpansion(::onc::proxy::kManual,
&manual_dict);
std::string manual_spec;
- AppendProxyServerForScheme(*manual_dict, proxy::kFtp, &manual_spec);
- AppendProxyServerForScheme(*manual_dict, proxy::kHttp, &manual_spec);
- AppendProxyServerForScheme(*manual_dict, proxy::kSocks, &manual_spec);
- AppendProxyServerForScheme(*manual_dict, proxy::kHttps, &manual_spec);
+ AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kFtp, &manual_spec);
+ AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttp, &manual_spec);
+ AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kSocks,
+ &manual_spec);
+ AppendProxyServerForScheme(*manual_dict, ::onc::proxy::kHttps,
+ &manual_spec);
const base::ListValue* exclude_domains = NULL;
net::ProxyBypassRules bypass_rules;
- if (onc_proxy_settings.GetListWithoutPathExpansion(proxy::kExcludeDomains,
- &exclude_domains)) {
+ if (onc_proxy_settings.GetListWithoutPathExpansion(
+ ::onc::proxy::kExcludeDomains, &exclude_domains)) {
bypass_rules.AssignFrom(
ConvertOncExcludeDomainsToBypassRules(*exclude_domains));
}
@@ -155,9 +158,9 @@ class UserStringSubstitution : public chromeos::onc::StringSubstitution {
virtual bool GetSubstitute(const std::string& placeholder,
std::string* substitute) const OVERRIDE {
- if (placeholder == chromeos::onc::substitutes::kLoginIDField)
+ if (placeholder == ::onc::substitutes::kLoginIDField)
*substitute = user_->GetAccountName(false);
- else if (placeholder == chromeos::onc::substitutes::kEmailField)
+ else if (placeholder == ::onc::substitutes::kEmailField)
*substitute = user_->email();
else
return false;
@@ -218,7 +221,7 @@ void ImportNetworksForUser(const chromeos::User* user,
*normalized_network);
scoped_ptr<NetworkUIData> ui_data = NetworkUIData::CreateFromONC(
- onc::ONC_SOURCE_USER_IMPORT, *normalized_network);
+ ::onc::ONC_SOURCE_USER_IMPORT, *normalized_network);
base::DictionaryValue ui_data_dict;
ui_data->FillDictionary(&ui_data_dict);
std::string ui_data_json;
@@ -238,7 +241,7 @@ void ImportNetworksForUser(const chromeos::User* user,
const base::DictionaryValue* FindPolicyForActiveUser(
const std::string& guid,
- onc::ONCSource* onc_source) {
+ ::onc::ONCSource* onc_source) {
const User* user = UserManager::Get()->GetActiveUser();
std::string username_hash = user ? user->username_hash() : std::string();
return NetworkHandler::Get()->managed_network_configuration_handler()->
@@ -257,7 +260,7 @@ const base::DictionaryValue* GetNetworkConfigByGUID(
DCHECK(network);
std::string current_guid;
- network->GetStringWithoutPathExpansion(onc::network_config::kGUID,
+ network->GetStringWithoutPathExpansion(::onc::network_config::kGUID,
&current_guid);
if (current_guid == guid)
return network;
@@ -275,18 +278,18 @@ const base::DictionaryValue* GetNetworkConfigForEthernetWithoutEAP(
DCHECK(network);
std::string type;
- network->GetStringWithoutPathExpansion(onc::network_config::kType, &type);
- if (type != onc::network_type::kEthernet)
+ network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type);
+ if (type != ::onc::network_type::kEthernet)
continue;
const base::DictionaryValue* ethernet = NULL;
- network->GetDictionaryWithoutPathExpansion(onc::network_config::kEthernet,
+ network->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 network;
}
return NULL;
@@ -368,22 +371,22 @@ const base::DictionaryValue* GetPolicyForFavoriteNetwork(
const PrefService* profile_prefs,
const PrefService* local_state_prefs,
const FavoriteState& favorite,
- onc::ONCSource* onc_source) {
+ ::onc::ONCSource* onc_source) {
VLOG(2) << "GetPolicyForFavoriteNetwork: " << favorite.path();
- *onc_source = onc::ONC_SOURCE_NONE;
+ *onc_source = ::onc::ONC_SOURCE_NONE;
const base::DictionaryValue* network_policy = GetPolicyForNetworkFromPref(
profile_prefs, prefs::kOpenNetworkConfiguration, favorite);
if (network_policy) {
VLOG(1) << "Network " << favorite.path() << " is managed by user policy.";
- *onc_source = onc::ONC_SOURCE_USER_POLICY;
+ *onc_source = ::onc::ONC_SOURCE_USER_POLICY;
return network_policy;
}
network_policy = GetPolicyForNetworkFromPref(
local_state_prefs, prefs::kDeviceOpenNetworkConfiguration, favorite);
if (network_policy) {
VLOG(1) << "Network " << favorite.path() << " is managed by device policy.";
- *onc_source = onc::ONC_SOURCE_DEVICE_POLICY;
+ *onc_source = ::onc::ONC_SOURCE_DEVICE_POLICY;
return network_policy;
}
VLOG(2) << "Network " << favorite.path() << " is unmanaged.";
@@ -393,7 +396,7 @@ const base::DictionaryValue* GetPolicyForFavoriteNetwork(
bool HasPolicyForFavoriteNetwork(const PrefService* profile_prefs,
const PrefService* local_state_prefs,
const FavoriteState& network) {
- onc::ONCSource ignored_onc_source;
+ ::onc::ONCSource ignored_onc_source;
const base::DictionaryValue* policy = onc::GetPolicyForFavoriteNetwork(
profile_prefs, local_state_prefs, network, &ignored_onc_source);
return policy != NULL;
diff --git a/chrome/browser/chromeos/net/onc_utils.h b/chrome/browser/chromeos/net/onc_utils.h
index 4aa2f4e..35d0762 100644
--- a/chrome/browser/chromeos/net/onc_utils.h
+++ b/chrome/browser/chromeos/net/onc_utils.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
class PrefService;
@@ -50,7 +50,7 @@ void ImportNetworksForUser(const chromeos::User* user,
// |onc_source| accordingly.
const base::DictionaryValue* FindPolicyForActiveUser(
const std::string& guid,
- onc::ONCSource* onc_source);
+ ::onc::ONCSource* onc_source);
// Returns the effective (user or device) policy for network |favorite|. Both
// |profile_prefs| and |local_state_prefs| might be NULL. Returns NULL if no
@@ -59,7 +59,7 @@ const base::DictionaryValue* GetPolicyForFavoriteNetwork(
const PrefService* profile_prefs,
const PrefService* local_state_prefs,
const FavoriteState& favorite,
- onc::ONCSource* onc_source);
+ ::onc::ONCSource* onc_source);
// Convenience function to check only whether a policy for a network exists.
bool HasPolicyForFavoriteNetwork(const PrefService* profile_prefs,
diff --git a/chrome/browser/chromeos/net/proxy_config_handler.cc b/chrome/browser/chromeos/net/proxy_config_handler.cc
index beda0e5..de0b58a 100644
--- a/chrome/browser/chromeos/net/proxy_config_handler.cc
+++ b/chrome/browser/chromeos/net/proxy_config_handler.cc
@@ -42,7 +42,7 @@ scoped_ptr<ProxyConfigDictionary> GetProxyConfigForFavoriteNetwork(
const PrefService* profile_prefs,
const PrefService* local_state_prefs,
const FavoriteState& network,
- onc::ONCSource* onc_source) {
+ ::onc::ONCSource* onc_source) {
const base::DictionaryValue* network_policy =
onc::GetPolicyForFavoriteNetwork(
profile_prefs, local_state_prefs, network, onc_source);
@@ -50,7 +50,7 @@ scoped_ptr<ProxyConfigDictionary> GetProxyConfigForFavoriteNetwork(
if (network_policy) {
const base::DictionaryValue* proxy_policy = NULL;
network_policy->GetDictionaryWithoutPathExpansion(
- onc::network_config::kProxySettings, &proxy_policy);
+ ::onc::network_config::kProxySettings, &proxy_policy);
if (!proxy_policy) {
// This policy doesn't set a proxy for this network. Nonetheless, this
// disallows changes by the user.
diff --git a/chrome/browser/chromeos/net/proxy_config_handler.h b/chrome/browser/chromeos/net/proxy_config_handler.h
index 4afe63f..5aae4d6 100644
--- a/chrome/browser/chromeos/net/proxy_config_handler.h
+++ b/chrome/browser/chromeos/net/proxy_config_handler.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_NET_PROXY_CONFIG_HANDLER_H_
#include "base/memory/scoped_ptr.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
class PrefRegistrySimple;
class PrefService;
diff --git a/chrome/browser/chromeos/options/network_property_ui_data.h b/chrome/browser/chromeos/options/network_property_ui_data.h
index a8ef5cb..10db2d7 100644
--- a/chrome/browser/chromeos/options/network_property_ui_data.h
+++ b/chrome/browser/chromeos/options/network_property_ui_data.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -27,25 +27,25 @@ class NetworkPropertyUIData {
NetworkPropertyUIData();
// Initializes with the given |onc_source| and no default value.
- explicit NetworkPropertyUIData(onc::ONCSource onc_source);
+ explicit NetworkPropertyUIData(::onc::ONCSource onc_source);
~NetworkPropertyUIData();
// Update the property object from dictionary, reading the key given by
// |property_key|.
- void ParseOncProperty(onc::ONCSource onc_source,
+ void ParseOncProperty(::onc::ONCSource onc_source,
const base::DictionaryValue* onc,
const std::string& property_key);
const base::Value* default_value() const { return default_value_.get(); }
bool IsManaged() 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);
}
bool IsEditable() const { return !IsManaged(); }
private:
- onc::ONCSource onc_source_;
+ ::onc::ONCSource onc_source_;
scoped_ptr<base::Value> default_value_;
DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData);
diff --git a/chrome/browser/chromeos/options/network_property_ui_data_unittest.cc b/chrome/browser/chromeos/options/network_property_ui_data_unittest.cc
index ee47250..4110b78 100644
--- a/chrome/browser/chromeos/options/network_property_ui_data_unittest.cc
+++ b/chrome/browser/chromeos/options/network_property_ui_data_unittest.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/chromeos/options/network_property_ui_data.h"
#include "base/values.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc
index 10b13d9..3bde579 100644
--- a/chrome/browser/chromeos/options/vpn_config_view.cc
+++ b/chrome/browser/chromeos/options/vpn_config_view.cc
@@ -18,7 +18,7 @@
#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 "components/onc/onc_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -84,9 +84,9 @@ std::string ProviderTypeIndexToONCDictKey(int provider_type_index) {
switch (provider_type_index) {
case PROVIDER_TYPE_INDEX_L2TP_IPSEC_PSK:
case PROVIDER_TYPE_INDEX_L2TP_IPSEC_USER_CERT:
- return chromeos::onc::vpn::kIPsec;
+ return onc::vpn::kIPsec;
case PROVIDER_TYPE_INDEX_OPEN_VPN:
- return chromeos::onc::vpn::kOpenVPN;
+ return onc::vpn::kOpenVPN;
}
NOTREACHED() << "Unhandled provider type index " << provider_type_index;
return std::string();
@@ -766,27 +766,27 @@ void VPNConfigView::ParseUIProperties(const NetworkState* vpn) {
std::string type_dict_name =
ProviderTypeIndexToONCDictKey(provider_type_index_);
if (provider_type_index_ == PROVIDER_TYPE_INDEX_L2TP_IPSEC_PSK) {
- ParseVPNUIProperty(vpn, type_dict_name, onc::ipsec::kServerCARef,
+ ParseVPNUIProperty(vpn, type_dict_name, ::onc::ipsec::kServerCARef,
&ca_cert_ui_data_);
- ParseVPNUIProperty(vpn, type_dict_name, onc::ipsec::kPSK,
+ ParseVPNUIProperty(vpn, type_dict_name, ::onc::ipsec::kPSK,
&psk_passphrase_ui_data_);
- ParseVPNUIProperty(vpn, type_dict_name, onc::ipsec::kGroup,
+ ParseVPNUIProperty(vpn, type_dict_name, ::onc::ipsec::kGroup,
&group_name_ui_data_);
} else if (provider_type_index_ == PROVIDER_TYPE_INDEX_OPEN_VPN) {
- ParseVPNUIProperty(vpn, type_dict_name, onc::openvpn::kServerCARef,
+ ParseVPNUIProperty(vpn, type_dict_name, ::onc::openvpn::kServerCARef,
&ca_cert_ui_data_);
}
- ParseVPNUIProperty(vpn, type_dict_name, onc::vpn::kClientCertRef,
+ ParseVPNUIProperty(vpn, type_dict_name, ::onc::vpn::kClientCertRef,
&user_cert_ui_data_);
const std::string credentials_dict_name(
provider_type_index_ == PROVIDER_TYPE_INDEX_L2TP_IPSEC_PSK ?
- onc::vpn::kL2TP : type_dict_name);
- ParseVPNUIProperty(vpn, credentials_dict_name, onc::vpn::kUsername,
+ ::onc::vpn::kL2TP : type_dict_name);
+ ParseVPNUIProperty(vpn, credentials_dict_name, ::onc::vpn::kUsername,
&username_ui_data_);
- ParseVPNUIProperty(vpn, credentials_dict_name, onc::vpn::kPassword,
+ ParseVPNUIProperty(vpn, credentials_dict_name, ::onc::vpn::kPassword,
&user_passphrase_ui_data_);
- ParseVPNUIProperty(vpn, credentials_dict_name, onc::vpn::kSaveCredentials,
+ ParseVPNUIProperty(vpn, credentials_dict_name, ::onc::vpn::kSaveCredentials,
&save_credentials_ui_data_);
}
@@ -1045,7 +1045,7 @@ void VPNConfigView::ParseVPNUIProperty(
const std::string& dict_key,
const std::string& key,
NetworkPropertyUIData* property_ui_data) {
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
const base::DictionaryValue* onc =
onc::FindPolicyForActiveUser(network->guid(), &onc_source);
@@ -1054,7 +1054,7 @@ void VPNConfigView::ParseVPNUIProperty(
onc_source,
onc,
base::StringPrintf("%s.%s.%s",
- onc::network_config::kVPN,
+ ::onc::network_config::kVPN,
dict_key.c_str(),
key.c_str()));
}
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index 05cb496..9e93cf7 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -19,7 +19,7 @@
#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 "components/onc/onc_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -880,24 +880,25 @@ void WifiConfigView::Init(bool show_8021x) {
DCHECK(wifi->type() == shill::kTypeWifi);
if (wifi->security() == shill::kSecurity8021x)
show_8021x = true;
- ParseWiFiEAPUIProperty(&eap_method_ui_data_, wifi, onc::eap::kOuter);
- ParseWiFiEAPUIProperty(&phase_2_auth_ui_data_, wifi, onc::eap::kInner);
- ParseWiFiEAPUIProperty(&user_cert_ui_data_, wifi, onc::eap::kClientCertRef);
+ ParseWiFiEAPUIProperty(&eap_method_ui_data_, wifi, ::onc::eap::kOuter);
+ ParseWiFiEAPUIProperty(&phase_2_auth_ui_data_, wifi, ::onc::eap::kInner);
+ ParseWiFiEAPUIProperty(&user_cert_ui_data_, wifi,
+ ::onc::eap::kClientCertRef);
ParseWiFiEAPUIProperty(&server_ca_cert_ui_data_, wifi,
- onc::eap::kServerCARef);
+ ::onc::eap::kServerCARef);
if (server_ca_cert_ui_data_.IsManaged()) {
ParseWiFiEAPUIProperty(&server_ca_cert_ui_data_, wifi,
- onc::eap::kUseSystemCAs);
+ ::onc::eap::kUseSystemCAs);
}
- ParseWiFiEAPUIProperty(&identity_ui_data_, wifi, onc::eap::kIdentity);
+ ParseWiFiEAPUIProperty(&identity_ui_data_, wifi, ::onc::eap::kIdentity);
ParseWiFiEAPUIProperty(&identity_anonymous_ui_data_, wifi,
- onc::eap::kAnonymousIdentity);
+ ::onc::eap::kAnonymousIdentity);
ParseWiFiEAPUIProperty(&save_credentials_ui_data_, wifi,
- onc::eap::kSaveCredentials);
+ ::onc::eap::kSaveCredentials);
if (show_8021x)
- ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, onc::eap::kPassword);
+ ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, ::onc::eap::kPassword);
else
- ParseWiFiUIProperty(&passphrase_ui_data_, wifi, onc::wifi::kPassphrase);
+ ParseWiFiUIProperty(&passphrase_ui_data_, wifi, ::onc::wifi::kPassphrase);
}
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
@@ -1319,14 +1320,14 @@ void WifiConfigView::ParseWiFiUIProperty(
NetworkPropertyUIData* property_ui_data,
const NetworkState* network,
const std::string& key) {
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
const base::DictionaryValue* onc =
onc::FindPolicyForActiveUser(network->guid(), &onc_source);
property_ui_data->ParseOncProperty(
onc_source,
onc,
- base::StringPrintf("%s.%s", onc::network_config::kWiFi, key.c_str()));
+ base::StringPrintf("%s.%s", ::onc::network_config::kWiFi, key.c_str()));
}
// static
@@ -1336,7 +1337,7 @@ void WifiConfigView::ParseWiFiEAPUIProperty(
const std::string& key) {
ParseWiFiUIProperty(
property_ui_data, network,
- base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str()));
+ base::StringPrintf("%s.%s", ::onc::wifi::kEAP, key.c_str()));
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/options/wimax_config_view.cc b/chrome/browser/chromeos/options/wimax_config_view.cc
index 5e99227..b197935 100644
--- a/chrome/browser/chromeos/options/wimax_config_view.cc
+++ b/chrome/browser/chromeos/options/wimax_config_view.cc
@@ -18,7 +18,7 @@
#include "chromeos/network/network_profile_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
index 671903f..7179622 100644
--- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
@@ -21,15 +21,13 @@
#include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
#include "chrome/common/pref_names.h"
#include "chromeos/dbus/power_policy_controller.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_utils.h"
#include "chromeos/network/onc/onc_validator.h"
+#include "components/onc/onc_constants.h"
#include "grit/generated_resources.h"
#include "policy/policy_constants.h"
-namespace onc = chromeos::onc;
-
namespace policy {
// static
@@ -63,7 +61,7 @@ bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
std::string onc_blob;
value->GetAsString(&onc_blob);
scoped_ptr<base::DictionaryValue> root_dict =
- onc::ReadDictionaryFromJson(onc_blob);
+ chromeos::onc::ReadDictionaryFromJson(onc_blob);
if (root_dict.get() == NULL) {
errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_FAILED);
return false;
@@ -71,19 +69,21 @@ bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
// Validate the ONC dictionary. We are liberal and ignore unknown field
// names and ignore invalid field names in kRecommended arrays.
- onc::Validator validator(false, // Ignore unknown fields.
- false, // Ignore invalid recommended field names.
- true, // Fail on missing fields.
- true); // Validate for managed ONC
+ chromeos::onc::Validator validator(
+ false, // Ignore unknown fields.
+ false, // Ignore invalid recommended field names.
+ true, // Fail on missing fields.
+ true); // Validate for managed ONC
validator.SetOncSource(onc_source_);
// ONC policies are always unencrypted.
- onc::Validator::Result validation_result;
+ chromeos::onc::Validator::Result validation_result;
root_dict = validator.ValidateAndRepairObject(
- &onc::kToplevelConfigurationSignature, *root_dict, &validation_result);
- if (validation_result == onc::Validator::VALID_WITH_WARNINGS)
+ &chromeos::onc::kToplevelConfigurationSignature, *root_dict,
+ &validation_result);
+ if (validation_result == chromeos::onc::Validator::VALID_WITH_WARNINGS)
errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_PARTIAL);
- else if (validation_result == onc::Validator::INVALID)
+ else if (validation_result == chromeos::onc::Validator::INVALID)
errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_FAILED);
// In any case, don't reject the policy as some networks or certificates
@@ -126,7 +126,7 @@ void NetworkConfigurationPolicyHandler::PrepareForDisplaying(
NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler(
const char* policy_name,
- chromeos::onc::ONCSource onc_source,
+ onc::ONCSource onc_source,
const char* pref_path)
: TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_STRING),
onc_source_(onc_source),
@@ -141,15 +141,15 @@ base::Value* NetworkConfigurationPolicyHandler::SanitizeNetworkConfig(
return NULL;
scoped_ptr<base::DictionaryValue> toplevel_dict =
- onc::ReadDictionaryFromJson(json_string);
+ chromeos::onc::ReadDictionaryFromJson(json_string);
if (!toplevel_dict)
return NULL;
// Placeholder to insert in place of the filtered setting.
const char kPlaceholder[] = "********";
- toplevel_dict = onc::MaskCredentialsInOncObject(
- onc::kToplevelConfigurationSignature,
+ toplevel_dict = chromeos::onc::MaskCredentialsInOncObject(
+ chromeos::onc::kToplevelConfigurationSignature,
*toplevel_dict,
kPlaceholder);
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
index 50de98d..f470b51 100644
--- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
+++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
@@ -7,7 +7,7 @@
#include "chrome/browser/policy/configuration_policy_handler.h"
#include "chromeos/network/network_ui_data.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -36,7 +36,7 @@ class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler {
private:
explicit NetworkConfigurationPolicyHandler(
const char* policy_name,
- chromeos::onc::ONCSource onc_source,
+ ::onc::ONCSource onc_source,
const char* pref_path);
// Takes network policy in Value representation and produces an output Value
@@ -47,7 +47,7 @@ class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler {
// The kind of ONC source that this handler represents. ONCSource
// distinguishes between user and device policy.
- const chromeos::onc::ONCSource onc_source_;
+ const ::onc::ONCSource onc_source_;
// The name of the pref to apply the policy to.
const char* pref_path_;
diff --git a/chrome/browser/chromeos/policy/network_configuration_updater.cc b/chrome/browser/chromeos/policy/network_configuration_updater.cc
index d9c2d14..d4f29c2 100644
--- a/chrome/browser/chromeos/policy/network_configuration_updater.cc
+++ b/chrome/browser/chromeos/policy/network_configuration_updater.cc
@@ -27,7 +27,7 @@ NetworkConfigurationUpdater::CreateForDevicePolicy(
PolicyService* policy_service,
chromeos::ManagedNetworkConfigurationHandler* network_config_handler) {
scoped_ptr<NetworkConfigurationUpdater> updater(
- new NetworkConfigurationUpdater(chromeos::onc::ONC_SOURCE_DEVICE_POLICY,
+ new NetworkConfigurationUpdater(onc::ONC_SOURCE_DEVICE_POLICY,
key::kDeviceOpenNetworkConfiguration,
certificate_importer.Pass(),
policy_service,
@@ -55,7 +55,7 @@ void NetworkConfigurationUpdater::OnPolicyServiceInitialized(
}
NetworkConfigurationUpdater::NetworkConfigurationUpdater(
- chromeos::onc::ONCSource onc_source,
+ onc::ONCSource onc_source,
std::string policy_key,
scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
PolicyService* policy_service,
diff --git a/chrome/browser/chromeos/policy/network_configuration_updater.h b/chrome/browser/chromeos/policy/network_configuration_updater.h
index c10a224..3e7fe0d 100644
--- a/chrome/browser/chromeos/policy/network_configuration_updater.h
+++ b/chrome/browser/chromeos/policy/network_configuration_updater.h
@@ -11,7 +11,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/policy/policy_service.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace base {
class Value;
@@ -55,7 +55,7 @@ class NetworkConfigurationUpdater : public PolicyService::Observer {
protected:
NetworkConfigurationUpdater(
- chromeos::onc::ONCSource onc_source,
+ onc::ONCSource onc_source,
std::string policy_key,
scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
PolicyService* policy_service,
@@ -71,7 +71,7 @@ class NetworkConfigurationUpdater : public PolicyService::Observer {
// modify |network_configs_onc| before the actual application.
virtual void ApplyNetworkPolicy(base::ListValue* network_configs_onc);
- chromeos::onc::ONCSource onc_source_;
+ onc::ONCSource onc_source_;
// Pointer to the global singleton or a test instance.
chromeos::ManagedNetworkConfigurationHandler* network_config_handler_;
diff --git a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
index 53cc0b5..6b48c5c 100644
--- a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
+++ b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
@@ -17,9 +17,9 @@
#include "chrome/browser/policy/policy_service_impl.h"
#include "chromeos/network/mock_managed_network_configuration_handler.h"
#include "chromeos/network/onc/mock_certificate_importer.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_test_utils.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "components/onc/onc_constants.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
#include "net/base/test_data_directory.h"
@@ -37,8 +37,6 @@ using testing::Return;
using testing::StrictMock;
using testing::_;
-namespace onc = ::chromeos::onc;
-
namespace policy {
namespace {
@@ -120,7 +118,7 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
empty_certificates_.reset(new base::ListValue);
scoped_ptr<base::DictionaryValue> fake_toplevel_onc =
- onc::ReadDictionaryFromJson(kFakeONC);
+ chromeos::onc::ReadDictionaryFromJson(kFakeONC);
scoped_ptr<base::Value> network_configs_value;
base::ListValue* network_configs = NULL;
@@ -136,7 +134,8 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
certs_value.release()->GetAsList(&certs);
fake_certificates_.reset(certs);
- certificate_importer_ = new StrictMock<onc::MockCertificateImporter>();
+ certificate_importer_ =
+ new StrictMock<chromeos::onc::MockCertificateImporter>();
certificate_importer_owned_.reset(certificate_importer_);
}
@@ -184,8 +183,8 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
// NetworkConfigurationUpdater. When that happens, |certificate_importer_|
// continues to point to that instance but |certificate_importer_owned_| is
// released.
- StrictMock<onc::MockCertificateImporter>* certificate_importer_;
- scoped_ptr<onc::CertificateImporter> certificate_importer_owned_;
+ StrictMock<chromeos::onc::MockCertificateImporter>* certificate_importer_;
+ scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer_owned_;
StrictMock<MockConfigurationPolicyProvider> provider_;
scoped_ptr<PolicyServiceImpl> policy_service_;
@@ -197,10 +196,10 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
TEST_F(NetworkConfigurationUpdaterTest, PolicyIsValidatedAndRepaired) {
std::string onc_policy =
- onc::test_utils::ReadTestData("toplevel_partially_invalid.onc");
+ chromeos::onc::test_utils::ReadTestData("toplevel_partially_invalid.onc");
scoped_ptr<base::DictionaryValue> onc_repaired =
- onc::test_utils::ReadTestDictionary(
+ chromeos::onc::test_utils::ReadTestDictionary(
"repaired_toplevel_partially_invalid.onc");
base::ListValue* network_configs_repaired = NULL;
diff --git a/chrome/browser/chromeos/policy/user_network_configuration_updater.cc b/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
index 1d7859b..990f5bd 100644
--- a/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
+++ b/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
@@ -44,7 +44,7 @@ UserNetworkConfigurationUpdater::UserNetworkConfigurationUpdater(
scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
PolicyService* policy_service,
chromeos::ManagedNetworkConfigurationHandler* network_config_handler)
- : NetworkConfigurationUpdater(chromeos::onc::ONC_SOURCE_USER_POLICY,
+ : NetworkConfigurationUpdater(onc::ONC_SOURCE_USER_POLICY,
key::kOpenNetworkConfiguration,
certificate_importer.Pass(),
policy_service,
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc
index 6f1ef8b..335a309 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.cc
+++ b/chrome/browser/chromeos/proxy_config_service_impl.cc
@@ -37,7 +37,7 @@ bool GetProxyConfig(const PrefService* profile_prefs,
const PrefService* local_state_prefs,
const FavoriteState& network,
net::ProxyConfig* proxy_config,
- onc::ONCSource* onc_source) {
+ ::onc::ONCSource* onc_source) {
scoped_ptr<ProxyConfigDictionary> proxy_dict =
proxy_config::GetProxyConfigForFavoriteNetwork(
profile_prefs, local_state_prefs, network, onc_source);
@@ -118,7 +118,7 @@ void ProxyConfigServiceImpl::DefaultNetworkChanged(
// static
bool ProxyConfigServiceImpl::IgnoreProxy(const PrefService* profile_prefs,
const std::string network_profile_path,
- onc::ONCSource onc_source) {
+ ::onc::ONCSource onc_source) {
if (!profile_prefs) {
// If the profile preference are not available, this must be the object
// associated to local state used for system requests or login-profile. Make
@@ -141,7 +141,7 @@ bool ProxyConfigServiceImpl::IgnoreProxy(const PrefService* profile_prefs,
VLOG(1) << "Respect proxy of not-shared networks.";
return false;
}
- if (onc_source == onc::ONC_SOURCE_DEVICE_POLICY) {
+ if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) {
policy::BrowserPolicyConnector* connector =
g_browser_process->browser_policy_connector();
const User* logged_in_user = UserManager::Get()->GetLoggedInUser();
@@ -173,7 +173,7 @@ void ProxyConfigServiceImpl::DetermineEffectiveConfigFromDefaultNetwork() {
net::ProxyConfigService::CONFIG_UNSET;
bool ignore_proxy = true;
if (network) {
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
const bool network_proxy_configured = chromeos::GetProxyConfig(
prefs(), local_state_prefs_, *network, &network_config, &onc_source);
ignore_proxy =
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.h b/chrome/browser/chromeos/proxy_config_service_impl.h
index 1037a05..81ec9e2 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.h
+++ b/chrome/browser/chromeos/proxy_config_service_impl.h
@@ -12,7 +12,7 @@
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
#include "chromeos/network/network_state_handler_observer.h"
-#include "chromeos/network/onc/onc_constants.h"
+#include "components/onc/onc_constants.h"
namespace chromeos {
diff --git a/chrome/browser/extensions/api/networking_private/DEPS b/chrome/browser/extensions/api/networking_private/DEPS
new file mode 100644
index 0000000..273d26b
--- /dev/null
+++ b/chrome/browser/extensions/api/networking_private/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+components/onc",
+]
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
index baff579..96aa57a 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
@@ -20,12 +20,12 @@
#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translator.h"
+#include "components/onc/onc_constants.h"
namespace api = extensions::api::networking_private;
-namespace onc = chromeos::onc;
+
using chromeos::DBusThreadManager;
using chromeos::ManagedNetworkConfigurationHandler;
using chromeos::NetworkHandler;
@@ -171,8 +171,8 @@ bool NetworkingPrivateGetStateFunction::RunImpl() {
scoped_ptr<base::DictionaryValue> result_dict(new base::DictionaryValue);
state->GetProperties(result_dict.get());
scoped_ptr<base::DictionaryValue> onc_network_part =
- onc::TranslateShillServiceToONCPart(*result_dict,
- &onc::kNetworkWithStateSignature);
+ chromeos::onc::TranslateShillServiceToONCPart(*result_dict,
+ &chromeos::onc::kNetworkWithStateSignature);
SetResult(onc_network_part.release());
SendResponse(true);
@@ -285,8 +285,8 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunImpl() {
(*it)->GetProperties(&shill_dictionary);
scoped_ptr<base::DictionaryValue> onc_network_part =
- onc::TranslateShillServiceToONCPart(shill_dictionary,
- &onc::kNetworkWithStateSignature);
+ chromeos::onc::TranslateShillServiceToONCPart(shill_dictionary,
+ &chromeos::onc::kNetworkWithStateSignature);
std::string onc_type;
onc_network_part->GetStringWithoutPathExpansion(onc::network_config::kType,
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
index 364fd84..42acc0e 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -25,8 +25,8 @@
#include "chromeos/dbus/shill_profile_client.h"
#include "chromeos/dbus/shill_service_client.h"
#include "chromeos/dbus/shill_stub_helper.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "components/onc/onc_constants.h"
#include "policy/policy_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#endif // OS_CHROMEOS
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
index c431c7f..9699833 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
@@ -15,10 +15,10 @@
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translator.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using extensions::EventRouter;
diff --git a/chrome/browser/ui/webui/net_internals/DEPS b/chrome/browser/ui/webui/net_internals/DEPS
new file mode 100644
index 0000000..273d26b
--- /dev/null
+++ b/chrome/browser/ui/webui/net_internals/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+components/onc",
+]
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index 00a9553..3f55e34 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -51,6 +51,7 @@
#include "chrome/common/net/url_fixer_upper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/onc/onc_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/resource_dispatcher_host.h"
@@ -85,7 +86,6 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
#include "chromeos/network/onc/onc_certificate_importer_impl.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/onc/onc_utils.h"
#endif
#if defined(OS_WIN)
@@ -1549,7 +1549,7 @@ void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) {
std::string error;
const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser();
if (user) {
- chromeos::onc::ONCSource onc_source = chromeos::onc::ONC_SOURCE_USER_IMPORT;
+ onc::ONCSource onc_source = onc::ONC_SOURCE_USER_IMPORT;
base::ListValue network_configs;
base::ListValue certificates;
diff --git a/chrome/browser/ui/webui/options/chromeos/DEPS b/chrome/browser/ui/webui/options/chromeos/DEPS
new file mode 100644
index 0000000..273d26b
--- /dev/null
+++ b/chrome/browser/ui/webui/options/chromeos/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+components/onc",
+]
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index c961564..cd32787 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -62,8 +62,8 @@
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_ui_data.h"
#include "chromeos/network/network_util.h"
-#include "chromeos/network/onc/onc_constants.h"
#include "chromeos/network/shill_property_util.h"
+#include "components/onc/onc_constants.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -635,7 +635,7 @@ void PopulateVPNDetails(const NetworkState* vpn,
}
dictionary->SetString(kTagUsername, username);
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
const base::DictionaryValue* onc =
onc::FindPolicyForActiveUser(vpn->guid(), &onc_source);
@@ -643,7 +643,8 @@ void PopulateVPNDetails(const NetworkState* vpn,
hostname_ui_data.ParseOncProperty(
onc_source,
onc,
- base::StringPrintf("%s.%s", onc::network_config::kVPN, onc::vpn::kHost));
+ base::StringPrintf("%s.%s", ::onc::network_config::kVPN,
+ ::onc::vpn::kHost));
std::string provider_host;
provider_properties->GetStringWithoutPathExpansion(
shill::kHostProperty, &provider_host);
@@ -1489,7 +1490,7 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
details_path_ = service_path;
- onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
+ ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
const base::DictionaryValue* onc =
onc::FindPolicyForActiveUser(network->guid(), &onc_source);
const NetworkPropertyUIData property_ui_data(onc_source);
@@ -1572,13 +1573,13 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
if (type == shill::kTypeWifi) {
onc_path_to_auto_connect = base::StringPrintf(
"%s.%s",
- onc::network_config::kWiFi,
- onc::wifi::kAutoConnect);
+ ::onc::network_config::kWiFi,
+ ::onc::wifi::kAutoConnect);
} else if (type == shill::kTypeVPN) {
onc_path_to_auto_connect = base::StringPrintf(
"%s.%s",
- onc::network_config::kVPN,
- onc::vpn::kAutoConnect);
+ ::onc::network_config::kVPN,
+ ::onc::vpn::kAutoConnect);
}
if (!onc_path_to_auto_connect.empty()) {
auto_connect_ui_data.ParseOncProperty(
diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc
index bd5c096..f0afd95 100644
--- a/chrome/browser/ui/webui/options/preferences_browsertest.cc
+++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc
@@ -833,10 +833,10 @@ class ProxyPreferencesBrowserTest : public PreferencesBrowserTest {
}
void VerifyCurrentProxyServer(const std::string& expected_server,
- chromeos::onc::ONCSource expected_source) {
+ onc::ONCSource expected_source) {
const chromeos::FavoriteState* network = GetDefaultFavoriteNetwork();
ASSERT_TRUE(network);
- chromeos::onc::ONCSource actual_source;
+ onc::ONCSource actual_source;
scoped_ptr<ProxyConfigDictionary> proxy_dict =
chromeos::proxy_config::GetProxyConfigForFavoriteNetwork(
pref_service_,
@@ -969,7 +969,7 @@ IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSSetProxy) {
SetProxyPref(chromeos::kProxySingleHttp, base::StringValue("www.adomain.xy"));
VerifyCurrentProxyServer("www.adomain.xy:123",
- chromeos::onc::ONC_SOURCE_NONE);
+ onc::ONC_SOURCE_NONE);
}
// Verify that default proxy ports are used and that ports can be updated
@@ -989,7 +989,7 @@ IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSProxyDefaultPorts) {
// Verify default ports.
VerifyCurrentProxyServer(
"http=a.com:80;https=4.3.2.1:80;ftp=c.com:80;socks=socks4://d.com:1080",
- chromeos::onc::ONC_SOURCE_NONE);
+ onc::ONC_SOURCE_NONE);
// Set and verify the ports.
SetProxyPref(chromeos::kProxyHttpPort, base::FundamentalValue(1));
@@ -999,7 +999,7 @@ IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSProxyDefaultPorts) {
VerifyCurrentProxyServer(
"http=a.com:1;https=4.3.2.1:2;ftp=c.com:3;socks=socks4://d.com:4",
- chromeos::onc::ONC_SOURCE_NONE);
+ onc::ONC_SOURCE_NONE);
}
#endif
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi
index 85fa450..5037378 100644
--- a/chrome/chrome_browser_chromeos.gypi
+++ b/chrome/chrome_browser_chromeos.gypi
@@ -50,6 +50,7 @@
# browser_chromeos #includes power_supply_properties.pb.h directly.
'../chromeos/chromeos.gyp:power_manager_proto',
'../chromeos/ime/input_method.gyp:gencode',
+ '../components/components.gyp:onc_component',
# This depends directly on the variations target, rather than just
# transitively via the common target because the proto sources need to
# be generated before code in this target can start building.
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 051faff..d36fc75 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -26,6 +26,7 @@
'debugger',
'in_memory_url_index_cache_proto',
'installer_util',
+ '../components/components.gyp:onc_component',
'../content/content.gyp:content_browser',
'../crypto/crypto.gyp:crypto',
'../device/bluetooth/bluetooth.gyp:device_bluetooth',
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 27f0325..65673a5 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -30,6 +30,7 @@
'safe_browsing_report_proto',
'feedback_proto',
'../components/components.gyp:auto_login_parser',
+ '../components/components.gyp:onc_component',
'../content/content.gyp:content_browser',
'../content/content.gyp:content_common',
'../crypto/crypto.gyp:crypto',
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp
index 64f1133..c50fdac 100644
--- a/chromeos/chromeos.gyp
+++ b/chromeos/chromeos.gyp
@@ -17,6 +17,7 @@
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_prefs',
+ '../components/components.gyp:onc_component',
'../crypto/crypto.gyp:crypto',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/linux/system.gyp:dbus',
@@ -272,8 +273,6 @@
'network/onc/onc_certificate_importer.h',
'network/onc/onc_certificate_importer_impl.cc',
'network/onc/onc_certificate_importer_impl.h',
- 'network/onc/onc_constants.cc',
- 'network/onc/onc_constants.h',
'network/onc/onc_mapper.cc',
'network/onc/onc_mapper.h',
'network/onc/onc_merger.cc',
@@ -453,6 +452,7 @@
'../base/base.gyp:test_support_base',
'../build/linux/system.gyp:dbus',
'../build/linux/system.gyp:ssl',
+ '../components/components.gyp:onc_component',
'../crypto/crypto.gyp:crypto',
'../dbus/dbus.gyp:dbus_test_support',
'../net/net.gyp:net',
diff --git a/chromeos/docs/OWNERS b/chromeos/docs/OWNERS
deleted file mode 100644
index 5e43217..0000000
--- a/chromeos/docs/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-pneubeck@chromium.org
-gspencer@chromium.org
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.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 */);
diff --git a/components/OWNERS b/components/OWNERS
index bcdeb28..b588c01 100644
--- a/components/OWNERS
+++ b/components/OWNERS
@@ -28,6 +28,12 @@ per-file nacl*=sehr@chromium.org
per-file navigation_interception.gypi=joth@chromium.org
per-file navigation_interception.gypi=mkosiba@chromium.org
+per-file onc.gypi=armansito@chromium.org
+per-file onc.gypi=gauravsh@chromium.org
+per-file onc.gypi=gspencer@chromium.org
+per-file onc.gypi=pneubeck@chromium.org
+per-file onc.gypi=stevenjb@chromium.org
+
per-file policy.gypi=mnissler@chromium.org
per-file policy.gypi=pastarmovj@chromium.org
per-file policy.gypi=joaodasilva@chromium.org
diff --git a/components/components.gyp b/components/components.gyp
index ea5af28..e16eda3 100644
--- a/components/components.gyp
+++ b/components/components.gyp
@@ -18,6 +18,7 @@
'dom_distiller.gypi',
'json_schema.gypi',
'navigation_interception.gypi',
+ 'onc.gypi',
'policy.gypi',
'sessions.gypi',
'startup_metric_utils.gypi',
diff --git a/components/onc.gypi b/components/onc.gypi
new file mode 100644
index 0000000..2ac52c5
--- /dev/null
+++ b/components/onc.gypi
@@ -0,0 +1,26 @@
+# Copyright 2013 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'onc_component',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'defines': [
+ 'ONC_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'onc/onc_constants.cc',
+ 'onc/onc_constants.h',
+ 'onc/onc_export.h',
+ ],
+ },
+ ],
+}
diff --git a/components/onc/OWNERS b/components/onc/OWNERS
new file mode 100644
index 0000000..a244e15
--- /dev/null
+++ b/components/onc/OWNERS
@@ -0,0 +1,5 @@
+armansito@chromium.org
+gauravsh@chromium.org
+gspencer@chromium.org
+pneubeck@chromium.org
+stevenjb@chromium.org
diff --git a/chromeos/docs/onc_spec.css b/components/onc/docs/onc_spec.css
index 8decd6e..d4f32b3 100644
--- a/chromeos/docs/onc_spec.css
+++ b/components/onc/docs/onc_spec.css
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+/* Copyright 2013 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. */
diff --git a/chromeos/docs/onc_spec.html b/components/onc/docs/onc_spec.html
index 0fe230b..0fe230b 100644
--- a/chromeos/docs/onc_spec.html
+++ b/components/onc/docs/onc_spec.html
diff --git a/chromeos/docs/onc_spec.js b/components/onc/docs/onc_spec.js
index ac51a8c..8cc027a 100644
--- a/chromeos/docs/onc_spec.js
+++ b/components/onc/docs/onc_spec.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/chromeos/network/onc/onc_constants.cc b/components/onc/onc_constants.cc
index 1214dfe..a634b70 100644
--- a/chromeos/network/onc/onc_constants.cc
+++ b/components/onc/onc_constants.cc
@@ -1,10 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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 {
+#include "components/onc/onc_constants.h"
// Constants for ONC properties.
namespace onc {
@@ -292,4 +290,3 @@ const char kEmailField[] = "${LOGIN_EMAIL}";
} // namespace onc
-} // namespace chromeos
diff --git a/components/onc/onc_constants.h b/components/onc/onc_constants.h
new file mode 100644
index 0000000..c245152
--- /dev/null
+++ b/components/onc/onc_constants.h
@@ -0,0 +1,314 @@
+// Copyright 2013 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 COMPONENTS_ONC_ONC_CONSTANTS_H_
+#define COMPONENTS_ONC_ONC_CONSTANTS_H_
+
+#include "components/onc/onc_export.h"
+
+// 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.
+ONC_EXPORT extern const char kAugmentationActiveSetting[];
+// The one of different setting sources (user/device policy, user/shared
+// settings) that has highest priority over the others.
+ONC_EXPORT extern const char kAugmentationEffectiveSetting[];
+ONC_EXPORT extern const char kAugmentationUnmanaged[];
+ONC_EXPORT extern const char kAugmentationUserPolicy[];
+ONC_EXPORT extern const char kAugmentationDevicePolicy[];
+ONC_EXPORT extern const char kAugmentationUserSetting[];
+ONC_EXPORT extern const char kAugmentationSharedSetting[];
+ONC_EXPORT extern const char kAugmentationUserEditable[];
+ONC_EXPORT extern const char kAugmentationDeviceEditable[];
+
+// This is no ONC key or value but used for logging only.
+// TODO(pneubeck): Remove.
+ONC_EXPORT extern const char kNetworkConfiguration[];
+
+// Common keys/values.
+ONC_EXPORT extern const char kRecommended[];
+ONC_EXPORT extern const char kRemove[];
+
+// Top Level Configuration
+namespace toplevel_config {
+ONC_EXPORT extern const char kCertificates[];
+ONC_EXPORT extern const char kEncryptedConfiguration[];
+ONC_EXPORT extern const char kNetworkConfigurations[];
+ONC_EXPORT extern const char kType[];
+ONC_EXPORT extern const char kUnencryptedConfiguration[];
+} // namespace toplevel_config
+
+// NetworkConfiguration.
+namespace network_config {
+ONC_EXPORT extern const char kCellular[];
+ONC_EXPORT extern const char kEthernet[];
+ONC_EXPORT extern const char kGUID[];
+ONC_EXPORT extern const char kIPConfigs[];
+ONC_EXPORT extern const char kName[];
+ONC_EXPORT extern const char kNameServers[];
+ONC_EXPORT extern const char kProxySettings[];
+ONC_EXPORT extern const char kSearchDomains[];
+ONC_EXPORT extern const char kServicePath[];
+ONC_EXPORT extern const char kConnectionState[];
+ONC_EXPORT extern const char kType[];
+ONC_EXPORT extern const char kVPN[];
+ONC_EXPORT extern const char kWiFi[];
+} // namespace network_config
+
+namespace network_type {
+ONC_EXPORT extern const char kAllTypes[];
+ONC_EXPORT extern const char kCellular[];
+ONC_EXPORT extern const char kEthernet[];
+ONC_EXPORT extern const char kVPN[];
+ONC_EXPORT extern const char kWiFi[];
+} // namespace network_type
+
+namespace cellular {
+ONC_EXPORT extern const char kActivateOverNonCellularNetwork[];
+ONC_EXPORT extern const char kActivationState[];
+ONC_EXPORT extern const char kAllowRoaming[];
+ONC_EXPORT extern const char kAPN[];
+ONC_EXPORT extern const char kCarrier[];
+ONC_EXPORT extern const char kESN[];
+ONC_EXPORT extern const char kFamily[];
+ONC_EXPORT extern const char kFirmwareRevision[];
+ONC_EXPORT extern const char kFoundNetworks[];
+ONC_EXPORT extern const char kHardwareRevision[];
+ONC_EXPORT extern const char kHomeProvider[];
+ONC_EXPORT extern const char kICCID[];
+ONC_EXPORT extern const char kIMEI[];
+ONC_EXPORT extern const char kIMSI[];
+ONC_EXPORT extern const char kManufacturer[];
+ONC_EXPORT extern const char kMDN[];
+ONC_EXPORT extern const char kMEID[];
+ONC_EXPORT extern const char kMIN[];
+ONC_EXPORT extern const char kModelID[];
+ONC_EXPORT extern const char kNetworkTechnology[];
+ONC_EXPORT extern const char kPRLVersion[];
+ONC_EXPORT extern const char kProviderRequiresRoaming[];
+ONC_EXPORT extern const char kRoamingState[];
+ONC_EXPORT extern const char kSelectedNetwork[];
+ONC_EXPORT extern const char kServingOperator[];
+ONC_EXPORT extern const char kSIMLockStatus[];
+ONC_EXPORT extern const char kSIMPresent[];
+ONC_EXPORT extern const char kSupportedCarriers[];
+ONC_EXPORT extern const char kSupportNetworkScan[];
+} // namespace cellular
+
+namespace cellular_provider {
+ONC_EXPORT extern const char kCode[];
+ONC_EXPORT extern const char kCountry[];
+ONC_EXPORT extern const char kName[];
+} // namespace cellular_provider
+
+namespace cellular_apn {
+ONC_EXPORT extern const char kName[];
+ONC_EXPORT extern const char kUsername[];
+ONC_EXPORT extern const char kPassword[];
+} // namespace cellular_apn
+
+
+namespace connection_state {
+ONC_EXPORT extern const char kConnected[];
+ONC_EXPORT extern const char kConnecting[];
+ONC_EXPORT extern const char kNotConnected[];
+} // namespace connection_state
+
+namespace ipconfig {
+ONC_EXPORT extern const char kGateway[];
+ONC_EXPORT extern const char kIPAddress[];
+ONC_EXPORT extern const char kIPv4[];
+ONC_EXPORT extern const char kIPv6[];
+ONC_EXPORT extern const char kRoutingPrefix[];
+ONC_EXPORT extern const char kType[];
+} // namespace ipconfig
+
+namespace ethernet {
+ONC_EXPORT extern const char kAuthentication[];
+ONC_EXPORT extern const char kEAP[];
+ONC_EXPORT extern const char kNone[];
+ONC_EXPORT extern const char k8021X[];
+} // namespace ethernet
+
+namespace wifi {
+ONC_EXPORT extern const char kAutoConnect[];
+ONC_EXPORT extern const char kBSSID[];
+ONC_EXPORT extern const char kEAP[];
+ONC_EXPORT extern const char kFrequency[];
+ONC_EXPORT extern const char kFrequencyList[];
+ONC_EXPORT extern const char kHiddenSSID[];
+ONC_EXPORT extern const char kNone[];
+ONC_EXPORT extern const char kPassphrase[];
+ONC_EXPORT extern const char kProxyURL[];
+ONC_EXPORT extern const char kSSID[];
+ONC_EXPORT extern const char kSecurity[];
+ONC_EXPORT extern const char kSignalStrength[];
+ONC_EXPORT extern const char kWEP_PSK[];
+ONC_EXPORT extern const char kWEP_8021X[];
+ONC_EXPORT extern const char kWPA_PSK[];
+ONC_EXPORT extern const char kWPA_EAP[];
+} // namespace wifi
+
+namespace certificate {
+ONC_EXPORT extern const char kAuthority[];
+ONC_EXPORT extern const char kClient[];
+ONC_EXPORT extern const char kCommonName[];
+ONC_EXPORT extern const char kEmailAddress[];
+ONC_EXPORT extern const char kEnrollmentURI[];
+ONC_EXPORT extern const char kGUID[];
+ONC_EXPORT extern const char kIssuerCARef[];
+ONC_EXPORT extern const char kIssuerCAPEMs[];
+ONC_EXPORT extern const char kIssuer[];
+ONC_EXPORT extern const char kLocality[];
+ONC_EXPORT extern const char kNone[];
+ONC_EXPORT extern const char kOrganization[];
+ONC_EXPORT extern const char kOrganizationalUnit[];
+ONC_EXPORT extern const char kPKCS12[];
+ONC_EXPORT extern const char kPattern[];
+ONC_EXPORT extern const char kRef[];
+ONC_EXPORT extern const char kServer[];
+ONC_EXPORT extern const char kSubject[];
+ONC_EXPORT extern const char kTrustBits[];
+ONC_EXPORT extern const char kType[];
+ONC_EXPORT extern const char kWeb[];
+ONC_EXPORT extern const char kX509[];
+} // namespace certificate
+
+namespace encrypted {
+ONC_EXPORT extern const char kAES256[];
+ONC_EXPORT extern const char kCipher[];
+ONC_EXPORT extern const char kCiphertext[];
+ONC_EXPORT extern const char kHMACMethod[];
+ONC_EXPORT extern const char kHMAC[];
+ONC_EXPORT extern const char kIV[];
+ONC_EXPORT extern const char kIterations[];
+ONC_EXPORT extern const char kPBKDF2[];
+ONC_EXPORT extern const char kSHA1[];
+ONC_EXPORT extern const char kSalt[];
+ONC_EXPORT extern const char kStretch[];
+} // namespace encrypted
+
+namespace eap {
+ONC_EXPORT extern const char kAnonymousIdentity[];
+ONC_EXPORT extern const char kAutomatic[];
+ONC_EXPORT extern const char kClientCertPattern[];
+ONC_EXPORT extern const char kClientCertRef[];
+ONC_EXPORT extern const char kClientCertType[];
+ONC_EXPORT extern const char kEAP_AKA[];
+ONC_EXPORT extern const char kEAP_FAST[];
+ONC_EXPORT extern const char kEAP_SIM[];
+ONC_EXPORT extern const char kEAP_TLS[];
+ONC_EXPORT extern const char kEAP_TTLS[];
+ONC_EXPORT extern const char kIdentity[];
+ONC_EXPORT extern const char kInner[];
+ONC_EXPORT extern const char kLEAP[];
+ONC_EXPORT extern const char kMD5[];
+ONC_EXPORT extern const char kMSCHAPv2[];
+ONC_EXPORT extern const char kOuter[];
+ONC_EXPORT extern const char kPAP[];
+ONC_EXPORT extern const char kPEAP[];
+ONC_EXPORT extern const char kPassword[];
+ONC_EXPORT extern const char kSaveCredentials[];
+ONC_EXPORT extern const char kServerCARef[];
+ONC_EXPORT extern const char kServerCAPEMs[];
+ONC_EXPORT extern const char kUseSystemCAs[];
+} // namespace eap
+
+namespace vpn {
+ONC_EXPORT extern const char kAutoConnect[];
+ONC_EXPORT extern const char kClientCertPattern[];
+ONC_EXPORT extern const char kClientCertRef[];
+ONC_EXPORT extern const char kClientCertType[];
+ONC_EXPORT extern const char kHost[];
+ONC_EXPORT extern const char kIPsec[];
+ONC_EXPORT extern const char kL2TP[];
+ONC_EXPORT extern const char kOpenVPN[];
+ONC_EXPORT extern const char kPassword[];
+ONC_EXPORT extern const char kSaveCredentials[];
+ONC_EXPORT extern const char kTypeL2TP_IPsec[];
+ONC_EXPORT extern const char kType[];
+ONC_EXPORT extern const char kUsername[];
+} // namespace vpn
+
+namespace ipsec {
+ONC_EXPORT extern const char kAuthenticationType[];
+ONC_EXPORT extern const char kCert[];
+ONC_EXPORT extern const char kEAP[];
+ONC_EXPORT extern const char kGroup[];
+ONC_EXPORT extern const char kIKEVersion[];
+ONC_EXPORT extern const char kPSK[];
+ONC_EXPORT extern const char kServerCARef[];
+ONC_EXPORT extern const char kServerCAPEMs[];
+ONC_EXPORT extern const char kXAUTH[];
+} // namespace ipsec
+
+namespace openvpn {
+ONC_EXPORT extern const char kAuthNoCache[];
+ONC_EXPORT extern const char kAuthRetry[];
+ONC_EXPORT extern const char kAuth[];
+ONC_EXPORT extern const char kCipher[];
+ONC_EXPORT extern const char kCompLZO[];
+ONC_EXPORT extern const char kCompNoAdapt[];
+ONC_EXPORT extern const char kInteract[];
+ONC_EXPORT extern const char kKeyDirection[];
+ONC_EXPORT extern const char kNoInteract[];
+ONC_EXPORT extern const char kNone[];
+ONC_EXPORT extern const char kNsCertType[];
+ONC_EXPORT extern const char kPort[];
+ONC_EXPORT extern const char kProto[];
+ONC_EXPORT extern const char kPushPeerInfo[];
+ONC_EXPORT extern const char kRemoteCertEKU[];
+ONC_EXPORT extern const char kRemoteCertKU[];
+ONC_EXPORT extern const char kRemoteCertTLS[];
+ONC_EXPORT extern const char kRenegSec[];
+ONC_EXPORT extern const char kServerCAPEMs[];
+ONC_EXPORT extern const char kServerCARef[];
+ONC_EXPORT extern const char kServerCertPEM[];
+ONC_EXPORT extern const char kServerCertRef[];
+ONC_EXPORT extern const char kServerPollTimeout[];
+ONC_EXPORT extern const char kServer[];
+ONC_EXPORT extern const char kShaper[];
+ONC_EXPORT extern const char kStaticChallenge[];
+ONC_EXPORT extern const char kTLSAuthContents[];
+ONC_EXPORT extern const char kTLSRemote[];
+ONC_EXPORT extern const char kVerb[];
+} // namespace openvpn
+
+namespace substitutes {
+ONC_EXPORT extern const char kEmailField[];
+ONC_EXPORT extern const char kLoginIDField[];
+} // namespace substitutes
+
+namespace proxy {
+ONC_EXPORT extern const char kDirect[];
+ONC_EXPORT extern const char kExcludeDomains[];
+ONC_EXPORT extern const char kFtp[];
+ONC_EXPORT extern const char kHost[];
+ONC_EXPORT extern const char kHttp[];
+ONC_EXPORT extern const char kHttps[];
+ONC_EXPORT extern const char kManual[];
+ONC_EXPORT extern const char kPAC[];
+ONC_EXPORT extern const char kPort[];
+ONC_EXPORT extern const char kSocks[];
+ONC_EXPORT extern const char kType[];
+ONC_EXPORT extern const char kWPAD[];
+} // namespace proxy
+
+} // namespace onc
+
+#endif // COMPONENTS_ONC_ONC_CONSTANTS_H_
+
diff --git a/components/onc/onc_export.h b/components/onc/onc_export.h
new file mode 100644
index 0000000..872ae3a
--- /dev/null
+++ b/components/onc/onc_export.h
@@ -0,0 +1,29 @@
+// Copyright 2013 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 COMPONENTS_ONC_ONC_EXPORT_H_
+#define COMPONENTS_ONC_ONC_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(ONC_IMPLEMENTATION)
+#define ONC_EXPORT __declspec(dllexport)
+#else
+#define ONC_EXPORT __declspec(dllimport)
+#endif // defined(ONC_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(ONC_IMPLEMENTATION)
+#define ONC_EXPORT __attribute__((visibility("default")))
+#else
+#define ONC_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define ONC_EXPORT
+#endif
+
+#endif // COMPONENTS_ONC_ONC_EXPORT_H_