summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-02-19 16:52:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 00:53:29 +0000
commitada74bf691606e7bf01e22810770f6e9229c58a8 (patch)
tree0ee6649246aff63f87df79c59e5fac8afc87183e
parent9117ee01cd00abbb78482cefc5d0640047a830b4 (diff)
downloadchromium_src-ada74bf691606e7bf01e22810770f6e9229c58a8.zip
chromium_src-ada74bf691606e7bf01e22810770f6e9229c58a8.tar.gz
chromium_src-ada74bf691606e7bf01e22810770f6e9229c58a8.tar.bz2
Use ManagednetworkConfigurationHandler where possible, add 'Shill' to NCH methods
This renames NetworkConfigurationHandler::Get/SetProperties and NetworkConfigurationHandler::CreateConfiguration to include 'Shill' in the name to make it clear that they are taking Shill properties instead of ONC. Also adds a comment to encourage use of MNCH. BUG=457936 For renaming change to wifi_access_point_info_provider_chromeos.cc: TBR=isherman@chromium.org Review URL: https://codereview.chromium.org/917393002 Cr-Commit-Position: refs/heads/master@{#317198}
-rw-r--r--ash/system/chromeos/network/network_state_list_detailed_view.cc1
-rw-r--r--chrome/browser/chromeos/mobile/mobile_activator.cc10
-rw-r--r--chrome/browser/chromeos/net/onc_utils.cc9
-rw-r--r--chrome/browser/chromeos/options/vpn_config_view.cc9
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc8
-rw-r--r--chrome/browser/chromeos/options/wimax_config_view.cc7
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc22
-rw-r--r--chrome/browser/ui/webui/chromeos/network_ui.cc2
-rw-r--r--chromeos/network/managed_network_configuration_handler_impl.cc37
-rw-r--r--chromeos/network/managed_network_configuration_handler_unittest.cc21
-rw-r--r--chromeos/network/network_configuration_handler.cc174
-rw-r--r--chromeos/network/network_configuration_handler.h36
-rw-r--r--chromeos/network/network_configuration_handler_unittest.cc37
-rw-r--r--chromeos/network/network_connection_handler.cc13
-rw-r--r--components/metrics/net/wifi_access_point_info_provider_chromeos.cc5
-rw-r--r--extensions/browser/api/vpn_provider/vpn_service.cc10
-rw-r--r--ui/chromeos/network/network_connect.cc30
-rw-r--r--ui/chromeos/network/network_connect.h9
-rw-r--r--ui/chromeos/network/network_state_notifier.cc2
19 files changed, 240 insertions, 202 deletions
diff --git a/ash/system/chromeos/network/network_state_list_detailed_view.cc b/ash/system/chromeos/network/network_state_list_detailed_view.cc
index 9d299e2..fb8a669 100644
--- a/ash/system/chromeos/network/network_state_list_detailed_view.cc
+++ b/ash/system/chromeos/network/network_state_list_detailed_view.cc
@@ -31,7 +31,6 @@
#include "chromeos/chromeos_switches.h"
#include "chromeos/device_event_log.h"
#include "chromeos/network/device_state.h"
-#include "chromeos/network/network_configuration_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "grit/ash_resources.h"
diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc
index f206a61..a538cf1 100644
--- a/chrome/browser/chromeos/mobile/mobile_activator.cc
+++ b/chrome/browser/chromeos/mobile/mobile_activator.cc
@@ -277,7 +277,7 @@ void MobileActivator::InitiateActivation(const std::string& service_path) {
}
void MobileActivator::ContinueActivation() {
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
service_path_,
base::Bind(&MobileActivator::GetPropertiesAndContinueActivation,
weak_ptr_factory_.GetWeakPtr()),
@@ -313,13 +313,11 @@ void MobileActivator::GetPropertiesAndContinueActivation(
// We want shill to connect us after activations, so enable autoconnect.
base::DictionaryValue auto_connect_property;
auto_connect_property.SetBoolean(shill::kAutoConnectProperty, true);
- NetworkHandler::Get()->network_configuration_handler()->SetProperties(
- service_path_,
- auto_connect_property,
+ NetworkHandler::Get()->network_configuration_handler()->SetShillProperties(
+ service_path_, auto_connect_property,
// Activation is triggered by the UI.
NetworkConfigurationObserver::SOURCE_USER_ACTION,
- base::Bind(&base::DoNothing),
- network_handler::ErrorCallback());
+ base::Bind(&base::DoNothing), network_handler::ErrorCallback());
StartActivation();
}
diff --git a/chrome/browser/chromeos/net/onc_utils.cc b/chrome/browser/chromeos/net/onc_utils.cc
index 3c067f4..abcd08a 100644
--- a/chrome/browser/chromeos/net/onc_utils.cc
+++ b/chrome/browser/chromeos/net/onc_utils.cc
@@ -217,6 +217,8 @@ void ImportNetworksForUser(const user_manager::User* user,
normalizer.NormalizeObject(&onc::kNetworkConfigurationSignature,
*network);
+ // TODO(pneubeck): Use ONC and ManagedNetworkConfigurationHandler instead.
+ // crbug.com/457936
scoped_ptr<base::DictionaryValue> shill_dict =
onc::TranslateONCObjectToShill(&onc::kNetworkConfigurationSignature,
*normalized_network);
@@ -243,7 +245,7 @@ void ImportNetworksForUser(const user_manager::User* user,
NetworkHandler::Get()->network_state_handler()->FirstNetworkByType(
NetworkTypePattern::Ethernet());
if (ethernet) {
- config_handler->SetProperties(
+ config_handler->SetShillProperties(
ethernet->path(), *shill_dict,
NetworkConfigurationObserver::SOURCE_USER_ACTION, base::Closure(),
network_handler::ErrorCallback());
@@ -252,9 +254,8 @@ void ImportNetworksForUser(const user_manager::User* user,
}
} else {
- config_handler->CreateConfiguration(
- *shill_dict,
- NetworkConfigurationObserver::SOURCE_USER_ACTION,
+ config_handler->CreateShillConfiguration(
+ *shill_dict, NetworkConfigurationObserver::SOURCE_USER_ACTION,
network_handler::StringResultCallback(),
network_handler::ErrorCallback());
}
diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc
index 024bbaf..7c3334b 100644
--- a/chrome/browser/chromeos/options/vpn_config_view.cc
+++ b/chrome/browser/chromeos/options/vpn_config_view.cc
@@ -375,7 +375,7 @@ bool VPNConfigView::Login() {
}
ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties,
- shared);
+ shared);
} else {
const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()->
GetNetworkState(service_path_);
@@ -693,10 +693,9 @@ void VPNConfigView::Init() {
Refresh();
if (vpn) {
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
- service_path_,
- base::Bind(&VPNConfigView::InitFromProperties,
- weak_ptr_factory_.GetWeakPtr()),
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
+ service_path_, base::Bind(&VPNConfigView::InitFromProperties,
+ weak_ptr_factory_.GetWeakPtr()),
base::Bind(&VPNConfigView::GetPropertiesError,
weak_ptr_factory_.GetWeakPtr()));
}
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index dc51bc9..f246182 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -1195,11 +1195,9 @@ void WifiConfigView::Init(bool show_8021x) {
UpdateErrorLabel();
if (network) {
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
- service_path_,
- base::Bind(&WifiConfigView::InitFromProperties,
- weak_ptr_factory_.GetWeakPtr(),
- show_8021x),
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
+ service_path_, base::Bind(&WifiConfigView::InitFromProperties,
+ weak_ptr_factory_.GetWeakPtr(), show_8021x),
base::Bind(&ShillError, "GetProperties"));
}
}
diff --git a/chrome/browser/chromeos/options/wimax_config_view.cc b/chrome/browser/chromeos/options/wimax_config_view.cc
index ed39f49..f5ea282 100644
--- a/chrome/browser/chromeos/options/wimax_config_view.cc
+++ b/chrome/browser/chromeos/options/wimax_config_view.cc
@@ -347,10 +347,9 @@ void WimaxConfigView::Init() {
UpdateErrorLabel();
if (wimax) {
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
- service_path_,
- base::Bind(&WimaxConfigView::InitFromProperties,
- weak_ptr_factory_.GetWeakPtr()),
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
+ service_path_, base::Bind(&WimaxConfigView::InitFromProperties,
+ weak_ptr_factory_.GetWeakPtr()),
base::Bind(&ShillError, "GetProperties"));
}
}
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index dffbc15..cf35c04 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -268,14 +268,12 @@ void MobileSetupUIHTMLSource::StartDataRequest(
int render_process_id,
int render_frame_id,
const content::URLDataSource::GotDataCallback& callback) {
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
path,
base::Bind(&MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&MobileSetupUIHTMLSource::GetPropertiesFailure,
- weak_ptr_factory_.GetWeakPtr(),
- callback, path));
+ weak_ptr_factory_.GetWeakPtr(), callback, path));
}
void MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest(
@@ -399,15 +397,12 @@ void MobileSetupHandler::OnActivationStateChanged(
return;
}
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
network->path(),
base::Bind(&MobileSetupHandler::GetPropertiesAndCallStatusChanged,
- weak_ptr_factory_.GetWeakPtr(),
- state,
- error_description),
+ weak_ptr_factory_.GetWeakPtr(), state, error_description),
base::Bind(&MobileSetupHandler::GetPropertiesFailure,
- weak_ptr_factory_.GetWeakPtr(),
- network->path(),
+ weak_ptr_factory_.GetWeakPtr(), network->path(),
kJsDeviceStatusChangedCallback));
}
@@ -529,13 +524,12 @@ void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) {
}
}
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
network->path(),
base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&MobileSetupHandler::GetPropertiesFailure,
- weak_ptr_factory_.GetWeakPtr(),
- network->path(),
+ weak_ptr_factory_.GetWeakPtr(), network->path(),
kJsGetDeviceInfoCallback));
}
diff --git a/chrome/browser/ui/webui/chromeos/network_ui.cc b/chrome/browser/ui/webui/chromeos/network_ui.cc
index 6cfb6a7..66df036 100644
--- a/chrome/browser/ui/webui/chromeos/network_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/network_ui.cc
@@ -89,7 +89,7 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
ErrorCallback(guid, "Error.InvalidNetworkGuid", nullptr);
return;
}
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
service_path,
base::Bind(&NetworkConfigMessageHandler::GetShillPropertiesSuccess,
weak_ptr_factory_.GetWeakPtr()),
diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc
index be67c52..424e9d2 100644
--- a/chromeos/network/managed_network_configuration_handler_impl.cc
+++ b/chromeos/network/managed_network_configuration_handler_impl.cc
@@ -51,8 +51,7 @@ const char kInvalidUserSettings[] = "InvalidUserSettings";
const char kNetworkAlreadyConfigured[] = "NetworkAlreadyConfigured";
const char kPoliciesNotInitialized[] = "PoliciesNotInitialized";
const char kProfileNotInitialized[] = "ProfileNotInitialized";
-const char kSetOnUnconfiguredNetwork[] = "SetCalledOnUnconfiguredNetwork";
-const char kUnknownProfilePath[] = "UnknownProfilePath";
+const char kUnconfiguredNetwork[] = "UnconfiguredNetwork";
const char kUnknownNetwork[] = "UnknownNetwork";
std::string ToDebugString(::onc::ONCSource source,
@@ -120,16 +119,14 @@ void ManagedNetworkConfigurationHandlerImpl::GetManagedProperties(
InvokeErrorCallback(service_path, error_callback, kPoliciesNotInitialized);
return;
}
- network_configuration_handler_->GetProperties(
+ network_configuration_handler_->GetShillProperties(
service_path,
base::Bind(
&ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback,
weak_ptr_factory_.GetWeakPtr(),
base::Bind(
&ManagedNetworkConfigurationHandlerImpl::SendManagedProperties,
- weak_ptr_factory_.GetWeakPtr(),
- userhash,
- callback,
+ weak_ptr_factory_.GetWeakPtr(), userhash, callback,
error_callback)),
error_callback);
}
@@ -200,15 +197,13 @@ void ManagedNetworkConfigurationHandlerImpl::GetProperties(
const std::string& service_path,
const network_handler::DictionaryResultCallback& callback,
const network_handler::ErrorCallback& error_callback) {
- network_configuration_handler_->GetProperties(
+ network_configuration_handler_->GetShillProperties(
service_path,
base::Bind(
&ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback,
weak_ptr_factory_.GetWeakPtr(),
base::Bind(&ManagedNetworkConfigurationHandlerImpl::SendProperties,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- error_callback)),
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback)),
error_callback);
}
@@ -240,20 +235,16 @@ void ManagedNetworkConfigurationHandlerImpl::SetProperties(
}
std::string guid = state->guid();
- if (guid.empty()) {
- // TODO(pneubeck): create an initial configuration in this case. As for
- // CreateConfiguration, user settings from older ChromeOS versions have to
- // determined here.
- InvokeErrorCallback(
- service_path, error_callback, kSetOnUnconfiguredNetwork);
- return;
- }
+ DCHECK(!guid.empty());
const std::string& profile_path = state->profile_path();
const NetworkProfile *profile =
network_profile_handler_->GetProfileForPath(profile_path);
if (!profile) {
- InvokeErrorCallback(service_path, error_callback, kUnknownProfilePath);
+ // TODO(pneubeck): create an initial configuration in this case. As for
+ // CreateConfiguration, user settings from older ChromeOS versions have to
+ // be determined here.
+ InvokeErrorCallback(service_path, error_callback, kUnconfiguredNetwork);
return;
}
@@ -313,7 +304,7 @@ void ManagedNetworkConfigurationHandlerImpl::SetProperties(
network_policy,
validated_user_settings.get()));
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, *shill_dictionary,
NetworkConfigurationObserver::SOURCE_USER_ACTION, callback,
error_callback);
@@ -357,7 +348,7 @@ void ManagedNetworkConfigurationHandlerImpl::CreateConfiguration(
NULL, // no network policy
&properties));
- network_configuration_handler_->CreateConfiguration(
+ network_configuration_handler_->CreateShillConfiguration(
*shill_dictionary, NetworkConfigurationObserver::SOURCE_USER_ACTION,
callback, error_callback);
}
@@ -503,7 +494,7 @@ void ManagedNetworkConfigurationHandlerImpl::OnProfileRemoved(
void ManagedNetworkConfigurationHandlerImpl::CreateConfigurationFromPolicy(
const base::DictionaryValue& shill_properties) {
- network_configuration_handler_->CreateConfiguration(
+ network_configuration_handler_->CreateShillConfiguration(
shill_properties, NetworkConfigurationObserver::SOURCE_POLICY,
base::Bind(
&ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork,
@@ -540,7 +531,7 @@ void ManagedNetworkConfigurationHandlerImpl::
shill_properties.MergeDictionary(&new_properties);
- network_configuration_handler_->CreateConfiguration(
+ network_configuration_handler_->CreateShillConfiguration(
shill_properties, NetworkConfigurationObserver::SOURCE_POLICY,
base::Bind(
&ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork,
diff --git a/chromeos/network/managed_network_configuration_handler_unittest.cc b/chromeos/network/managed_network_configuration_handler_unittest.cc
index 85db89d..4d965eb 100644
--- a/chromeos/network/managed_network_configuration_handler_unittest.cc
+++ b/chromeos/network/managed_network_configuration_handler_unittest.cc
@@ -64,10 +64,26 @@ const char kUser1ProfilePath[] = "/profile/user1/shill";
MATCHER_P(IsEqualTo,
value,
std::string(negation ? "isn't" : "is") + " equal to " +
- ValueToString(value)) {
+ ValueToString(value)) {
return value->Equals(&arg);
}
+// Match properties in |value| to |arg|. |arg| may contain extra properties).
+MATCHER_P(MatchesProperties,
+ value,
+ std::string(negation ? "does't match " : "matches ") +
+ ValueToString(value)) {
+ for (base::DictionaryValue::Iterator iter(*value); !iter.IsAtEnd();
+ iter.Advance()) {
+ const base::Value* property;
+ if (!arg.GetWithoutPathExpansion(iter.key(), &property) ||
+ !iter.value().Equals(property)) {
+ return false;
+ }
+ }
+ return true;
+}
+
class ShillProfileTestClient {
public:
typedef ShillClientHelper::DictionaryValueCallbackWithoutStatus
@@ -865,8 +881,7 @@ TEST_F(ManagedNetworkConfigurationHandlerTest, AutoConnectDisallowed) {
EXPECT_CALL(*mock_manager_client_,
ConfigureServiceForProfile(
dbus::ObjectPath(kUser1ProfilePath),
- IsEqualTo(expected_shill_properties.get()),
- _, _));
+ MatchesProperties(expected_shill_properties.get()), _, _));
SetPolicy(::onc::ONC_SOURCE_USER_POLICY,
kUser1,
diff --git a/chromeos/network/network_configuration_handler.cc b/chromeos/network/network_configuration_handler.cc
index fb4b4f5..24204d3 100644
--- a/chromeos/network/network_configuration_handler.cc
+++ b/chromeos/network/network_configuration_handler.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/format_macros.h"
+#include "base/guid.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -20,8 +21,8 @@
#include "chromeos/dbus/shill_manager_client.h"
#include "chromeos/dbus/shill_profile_client.h"
#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/device_event_log.h"
#include "chromeos/network/network_device_handler.h"
-#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/shill_property_util.h"
@@ -35,8 +36,8 @@ namespace {
// Strip surrounding "" from keys (if present).
std::string StripQuotations(const std::string& in_str) {
size_t len = in_str.length();
- if (len >= 2 && in_str[0] == '"' && in_str[len-1] == '"')
- return in_str.substr(1, len-2);
+ if (len >= 2 && in_str[0] == '"' && in_str[len - 1] == '"')
+ return in_str.substr(1, len - 2);
return in_str;
}
@@ -44,9 +45,9 @@ void InvokeErrorCallback(const std::string& service_path,
const network_handler::ErrorCallback& error_callback,
const std::string& error_name) {
std::string error_msg = "Config Error: " + error_name;
- NET_LOG_ERROR(error_msg, service_path);
- network_handler::RunErrorCallback(
- error_callback, service_path, error_name, error_msg);
+ NET_LOG(ERROR) << error_msg << ": " << service_path;
+ network_handler::RunErrorCallback(error_callback, service_path, error_name,
+ error_msg);
}
void SetNetworkProfileErrorCallback(
@@ -56,20 +57,19 @@ void SetNetworkProfileErrorCallback(
const std::string& dbus_error_name,
const std::string& dbus_error_message) {
network_handler::ShillErrorCallbackFunction(
- "Config.SetNetworkProfile Failed: " + profile_path,
- service_path, error_callback,
- dbus_error_name, dbus_error_message);
+ "Config.SetNetworkProfile Failed: " + profile_path, service_path,
+ error_callback, dbus_error_name, dbus_error_message);
}
void LogConfigProperties(const std::string& desc,
const std::string& path,
const base::DictionaryValue& properties) {
- for (base::DictionaryValue::Iterator iter(properties);
- !iter.IsAtEnd(); iter.Advance()) {
+ for (base::DictionaryValue::Iterator iter(properties); !iter.IsAtEnd();
+ iter.Advance()) {
std::string v = "******";
if (!shill_property_util::IsPassphraseKey(iter.key()))
base::JSONWriter::Write(&iter.value(), &v);
- NET_LOG_DEBUG(desc, path + "." + iter.key() + "=" + v);
+ NET_LOG(DEBUG) << desc << ": " << path + "." + iter.key() + "=" + v;
}
}
@@ -93,12 +93,12 @@ class NetworkConfigurationHandler::ProfileEntryDeleter
guid_(guid),
source_(source),
callback_(callback),
- error_callback_(error_callback) {
- }
+ error_callback_(error_callback) {}
void Run() {
- DBusThreadManager::Get()->GetShillServiceClient()->
- GetLoadableProfileEntries(
+ DBusThreadManager::Get()
+ ->GetShillServiceClient()
+ ->GetLoadableProfileEntries(
dbus::ObjectPath(service_path_),
base::Bind(&ProfileEntryDeleter::GetProfileEntriesToDeleteCallback,
AsWeakPtr()));
@@ -109,46 +109,45 @@ class NetworkConfigurationHandler::ProfileEntryDeleter
DBusMethodCallStatus call_status,
const base::DictionaryValue& profile_entries) {
if (call_status != DBUS_METHOD_CALL_SUCCESS) {
- InvokeErrorCallback(
- service_path_, error_callback_, "GetLoadableProfileEntriesFailed");
+ InvokeErrorCallback(service_path_, error_callback_,
+ "GetLoadableProfileEntriesFailed");
// ProfileEntryDeleterCompleted will delete this.
owner_->ProfileEntryDeleterCompleted(service_path_, guid_, source_,
false /* failed */);
return;
}
- for (base::DictionaryValue::Iterator iter(profile_entries);
- !iter.IsAtEnd(); iter.Advance()) {
+ for (base::DictionaryValue::Iterator iter(profile_entries); !iter.IsAtEnd();
+ iter.Advance()) {
std::string profile_path = StripQuotations(iter.key());
std::string entry_path;
iter.value().GetAsString(&entry_path);
if (profile_path.empty() || entry_path.empty()) {
- NET_LOG_ERROR("Failed to parse Profile Entry", base::StringPrintf(
- "%s: %s", profile_path.c_str(), entry_path.c_str()));
+ NET_LOG(ERROR) << "Failed to parse Profile Entry: " << profile_path
+ << ": " << entry_path;
continue;
}
if (profile_delete_entries_.count(profile_path) != 0) {
- NET_LOG_ERROR("Multiple Profile Entries", base::StringPrintf(
- "%s: %s", profile_path.c_str(), entry_path.c_str()));
+ NET_LOG(ERROR) << "Multiple Profile Entries: " << profile_path << ": "
+ << entry_path;
continue;
}
- NET_LOG_DEBUG("Delete Profile Entry", base::StringPrintf(
- "%s: %s", profile_path.c_str(), entry_path.c_str()));
+ NET_LOG(DEBUG) << "Delete Profile Entry: " << profile_path << ": "
+ << entry_path;
profile_delete_entries_[profile_path] = entry_path;
DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry(
- dbus::ObjectPath(profile_path),
- entry_path,
+ dbus::ObjectPath(profile_path), entry_path,
base::Bind(&ProfileEntryDeleter::ProfileEntryDeletedCallback,
AsWeakPtr(), profile_path, entry_path),
- base::Bind(&ProfileEntryDeleter::ShillErrorCallback,
- AsWeakPtr(), profile_path, entry_path));
+ base::Bind(&ProfileEntryDeleter::ShillErrorCallback, AsWeakPtr(),
+ profile_path, entry_path));
}
}
void ProfileEntryDeletedCallback(const std::string& profile_path,
const std::string& entry) {
- NET_LOG_DEBUG("Profile Entry Deleted", base::StringPrintf(
- "%s: %s", profile_path.c_str(), entry.c_str()));
+ NET_LOG(DEBUG) << "Profile Entry Deleted: " << profile_path << ": "
+ << entry;
profile_delete_entries_.erase(profile_path);
if (!profile_delete_entries_.empty())
return;
@@ -199,34 +198,50 @@ void NetworkConfigurationHandler::RemoveObserver(
observers_.RemoveObserver(observer);
}
-void NetworkConfigurationHandler::GetProperties(
+void NetworkConfigurationHandler::GetShillProperties(
const std::string& service_path,
const network_handler::DictionaryResultCallback& callback,
const network_handler::ErrorCallback& error_callback) {
- NET_LOG_USER("GetProperties", service_path);
+ NET_LOG(USER) << "GetProperties: " << service_path;
DBusThreadManager::Get()->GetShillServiceClient()->GetProperties(
dbus::ObjectPath(service_path),
base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback,
AsWeakPtr(), callback, error_callback, service_path));
}
-void NetworkConfigurationHandler::SetProperties(
+void NetworkConfigurationHandler::SetShillProperties(
const std::string& service_path,
- const base::DictionaryValue& properties,
+ const base::DictionaryValue& shill_properties,
NetworkConfigurationObserver::Source source,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) {
- if (properties.empty()) {
+ if (shill_properties.empty()) {
if (!callback.is_null())
callback.Run();
return;
}
- NET_LOG_USER("SetProperties", service_path);
- LogConfigProperties("SetProperty", service_path, properties);
+ NET_LOG(USER) << "SetProperties: " << service_path;
- scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
+ scoped_ptr<base::DictionaryValue> properties_to_set(
+ shill_properties.DeepCopy());
+
+ // Make sure that the GUID is saved to Shill when setting properties.
+ std::string guid;
+ properties_to_set->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid);
+ if (guid.empty()) {
+ const NetworkState* network_state =
+ network_state_handler_->GetNetworkState(service_path);
+ guid = network_state ? network_state->guid() : base::GenerateGUID();
+ properties_to_set->SetStringWithoutPathExpansion(shill::kGuidProperty,
+ guid);
+ }
+
+ LogConfigProperties("SetProperty", service_path, *properties_to_set);
+
+ scoped_ptr<base::DictionaryValue> properties_copy(
+ properties_to_set->DeepCopy());
DBusThreadManager::Get()->GetShillServiceClient()->SetProperties(
- dbus::ObjectPath(service_path), properties,
+ dbus::ObjectPath(service_path), *properties_to_set,
base::Bind(&NetworkConfigurationHandler::SetPropertiesSuccessCallback,
AsWeakPtr(), service_path, base::Passed(&properties_copy),
source, callback),
@@ -235,11 +250,11 @@ void NetworkConfigurationHandler::SetProperties(
// If we set the StaticIPConfig property, request an IP config refresh
// after calling SetProperties.
- if (properties.HasKey(shill::kStaticIPConfigProperty))
+ if (properties_to_set->HasKey(shill::kStaticIPConfigProperty))
RequestRefreshIPConfigs(service_path);
}
-void NetworkConfigurationHandler::ClearProperties(
+void NetworkConfigurationHandler::ClearShillProperties(
const std::string& service_path,
const std::vector<std::string>& names,
const base::Closure& callback,
@@ -249,49 +264,64 @@ void NetworkConfigurationHandler::ClearProperties(
callback.Run();
return;
}
- NET_LOG_USER("ClearProperties", service_path);
+ NET_LOG(USER) << "ClearProperties: " << service_path;
for (std::vector<std::string>::const_iterator iter = names.begin();
iter != names.end(); ++iter) {
- NET_LOG_DEBUG("ClearProperty", service_path + "." + *iter);
+ NET_LOG(DEBUG) << "ClearProperty: " << service_path << "." << *iter;
}
DBusThreadManager::Get()->GetShillServiceClient()->ClearProperties(
- dbus::ObjectPath(service_path),
- names,
+ dbus::ObjectPath(service_path), names,
base::Bind(&NetworkConfigurationHandler::ClearPropertiesSuccessCallback,
AsWeakPtr(), service_path, names, callback),
base::Bind(&NetworkConfigurationHandler::ClearPropertiesErrorCallback,
AsWeakPtr(), service_path, error_callback));
}
-void NetworkConfigurationHandler::CreateConfiguration(
- const base::DictionaryValue& properties,
+void NetworkConfigurationHandler::CreateShillConfiguration(
+ const base::DictionaryValue& shill_properties,
NetworkConfigurationObserver::Source source,
const network_handler::StringResultCallback& callback,
const network_handler::ErrorCallback& error_callback) {
ShillManagerClient* manager =
DBusThreadManager::Get()->GetShillManagerClient();
std::string type;
- properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
+ shill_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
DCHECK(!type.empty());
+
+ std::string network_id =
+ shill_property_util::GetNetworkIdFromProperties(shill_properties);
+
if (NetworkTypePattern::Ethernet().MatchesType(type)) {
- InvokeErrorCallback(
- shill_property_util::GetNetworkIdFromProperties(properties),
- error_callback,
- "ConfigureServiceForProfile: Invalid type: " + type);
+ InvokeErrorCallback(network_id, error_callback,
+ "ConfigureServiceForProfile: Invalid type: " + type);
return;
}
- NET_LOG_USER("CreateConfiguration: " + type,
- shill_property_util::GetNetworkIdFromProperties(properties));
- LogConfigProperties("Configure", type, properties);
+ scoped_ptr<base::DictionaryValue> properties_to_set(
+ shill_properties.DeepCopy());
+
+ NET_LOG(USER) << "CreateConfiguration: " << type << ": " << network_id;
std::string profile_path;
- properties.GetStringWithoutPathExpansion(shill::kProfileProperty,
- &profile_path);
+ properties_to_set->GetStringWithoutPathExpansion(shill::kProfileProperty,
+ &profile_path);
DCHECK(!profile_path.empty());
- scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
+
+ // Make sure that the GUID is saved to Shill when configuring networks.
+ std::string guid;
+ properties_to_set->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid);
+ if (guid.empty()) {
+ guid = base::GenerateGUID();
+ properties_to_set->SetStringWithoutPathExpansion(
+ ::onc::network_config::kGUID, guid);
+ }
+
+ LogConfigProperties("Configure", type, *properties_to_set);
+
+ scoped_ptr<base::DictionaryValue> properties_copy(
+ properties_to_set->DeepCopy());
manager->ConfigureServiceForProfile(
- dbus::ObjectPath(profile_path), properties,
+ dbus::ObjectPath(profile_path), *properties_to_set,
base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
AsWeakPtr(), profile_path, source,
base::Passed(&properties_copy), callback),
@@ -307,8 +337,8 @@ void NetworkConfigurationHandler::RemoveConfiguration(
// Service.Remove is not reliable. Instead, request the profile entries
// for the service and remove each entry.
if (ContainsKey(profile_entry_deleters_, service_path)) {
- InvokeErrorCallback(
- service_path, error_callback, "RemoveConfigurationInProgress");
+ InvokeErrorCallback(service_path, error_callback,
+ "RemoveConfigurationInProgress");
return;
}
@@ -317,7 +347,7 @@ void NetworkConfigurationHandler::RemoveConfiguration(
network_state_handler_->GetNetworkState(service_path);
if (network_state)
guid = network_state->guid();
- NET_LOG_USER("Remove Configuration", service_path);
+ NET_LOG(USER) << "Remove Configuration: " << service_path;
ProfileEntryDeleter* deleter = new ProfileEntryDeleter(
this, service_path, guid, source, callback, error_callback);
profile_entry_deleters_[service_path] = deleter;
@@ -330,7 +360,8 @@ void NetworkConfigurationHandler::SetNetworkProfile(
NetworkConfigurationObserver::Source source,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) {
- NET_LOG_USER("SetNetworkProfile", service_path + ": " + profile_path);
+ NET_LOG(USER) << "SetNetworkProfile: " << service_path << ": "
+ << profile_path;
base::StringValue profile_path_value(profile_path);
DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
dbus::ObjectPath(service_path), shill::kProfileProperty,
@@ -348,8 +379,8 @@ NetworkConfigurationHandler::NetworkConfigurationHandler()
}
NetworkConfigurationHandler::~NetworkConfigurationHandler() {
- STLDeleteContainerPairSecondPointers(
- profile_entry_deleters_.begin(), profile_entry_deleters_.end());
+ STLDeleteContainerPairSecondPointers(profile_entry_deleters_.begin(),
+ profile_entry_deleters_.end());
}
void NetworkConfigurationHandler::Init(
@@ -468,8 +499,7 @@ void NetworkConfigurationHandler::SetPropertiesErrorCallback(
const std::string& dbus_error_name,
const std::string& dbus_error_message) {
network_handler::ShillErrorCallbackFunction(
- "Config.SetProperties Failed",
- service_path, error_callback,
+ "Config.SetProperties Failed", service_path, error_callback,
dbus_error_name, dbus_error_message);
// Some properties may have changed so request an update regardless.
network_state_handler_->RequestUpdateForNetwork(service_path);
@@ -490,7 +520,8 @@ void NetworkConfigurationHandler::ClearPropertiesSuccessCallback(
if (!success) {
// If a property was cleared that has never been set, the clear will fail.
// We do not track which properties have been set, so just log the error.
- NET_LOG_ERROR("ClearProperties Failed: " + names[i], service_path);
+ NET_LOG(ERROR) << "ClearProperties Failed: " << service_path << ": "
+ << names[i];
}
}
@@ -505,8 +536,7 @@ void NetworkConfigurationHandler::ClearPropertiesErrorCallback(
const std::string& dbus_error_name,
const std::string& dbus_error_message) {
network_handler::ShillErrorCallbackFunction(
- "Config.ClearProperties Failed",
- service_path, error_callback,
+ "Config.ClearProperties Failed", service_path, error_callback,
dbus_error_name, dbus_error_message);
// Some properties may have changed so request an update regardless.
network_state_handler_->RequestUpdateForNetwork(service_path);
diff --git a/chromeos/network/network_configuration_handler.h b/chromeos/network/network_configuration_handler.h
index aa77ef2..0ab68f0 100644
--- a/chromeos/network/network_configuration_handler.h
+++ b/chromeos/network/network_configuration_handler.h
@@ -66,19 +66,20 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
// Gets the properties of the network with id |service_path|. See note on
// |callback| and |error_callback|, in class description above.
- void GetProperties(const std::string& service_path,
- const network_handler::DictionaryResultCallback& callback,
- const network_handler::ErrorCallback& error_callback);
+ void GetShillProperties(
+ const std::string& service_path,
+ const network_handler::DictionaryResultCallback& callback,
+ const network_handler::ErrorCallback& error_callback);
// Sets the properties of the network with id |service_path|. This means the
// given properties will be merged with the existing settings, and it won't
// clear any existing properties. See notes on |source| and callbacks in class
// description above.
- void SetProperties(const std::string& service_path,
- const base::DictionaryValue& properties,
- NetworkConfigurationObserver::Source source,
- const base::Closure& callback,
- const network_handler::ErrorCallback& error_callback);
+ void SetShillProperties(const std::string& service_path,
+ const base::DictionaryValue& shill_properties,
+ NetworkConfigurationObserver::Source source,
+ const base::Closure& callback,
+ const network_handler::ErrorCallback& error_callback);
// Removes the properties with the given property paths. If any of them are
// unable to be cleared, the |error_callback| will only be run once with
@@ -86,19 +87,22 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
// "errors" key of the error data, and the |callback| will not be run, even
// though some of the properties may have been cleared. If there are no
// errors, |callback| will be run.
- void ClearProperties(const std::string& service_path,
- const std::vector<std::string>& property_paths,
- const base::Closure& callback,
- const network_handler::ErrorCallback& error_callback);
+ void ClearShillProperties(
+ const std::string& service_path,
+ const std::vector<std::string>& property_paths,
+ const base::Closure& callback,
+ const network_handler::ErrorCallback& error_callback);
// Creates a network with the given |properties| in the specified Shill
// profile, and returns the new service_path to |callback| if successful.
// kProfileProperty must be set in |properties|. See notes on |source| and
// callbacks in class description above. This may also be used to update an
// existing matching configuration, see Shill documentation for
- // Manager.ConfigureServiceForProfile.
- void CreateConfiguration(
- const base::DictionaryValue& properties,
+ // Manager.ConfigureServiceForProfile. NOTE: Normally
+ // ManagedNetworkConfigurationHandler should be used to call
+ // CreateConfiguration. This will set GUID if not provided.
+ void CreateShillConfiguration(
+ const base::DictionaryValue& shill_properties,
NetworkConfigurationObserver::Source source,
const network_handler::StringResultCallback& callback,
const network_handler::ErrorCallback& error_callback);
@@ -124,7 +128,7 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
NetworkStateHandler* network_state_handler,
NetworkDeviceHandler* network_device_handler);
- protected:
+ private:
friend class ClientCertResolverTest;
friend class NetworkHandler;
friend class NetworkConfigurationHandlerTest;
diff --git a/chromeos/network/network_configuration_handler_unittest.cc b/chromeos/network/network_configuration_handler_unittest.cc
index 1b5b3bb..2772fc9 100644
--- a/chromeos/network/network_configuration_handler_unittest.cc
+++ b/chromeos/network/network_configuration_handler_unittest.cc
@@ -277,6 +277,14 @@ class NetworkConfigurationHandlerTest : public testing::Test {
service_path);
}
+ void CreateConfiguration(const std::string& service_path,
+ const base::DictionaryValue& properties) {
+ network_configuration_handler_->CreateShillConfiguration(
+ properties, NetworkConfigurationObserver::SOURCE_USER_ACTION,
+ base::Bind(&StringResultCallback, service_path),
+ base::Bind(&ErrorCallback, false, std::string()));
+ }
+
protected:
MockShillManagerClient* mock_manager_client_;
MockShillProfileClient* mock_profile_client_;
@@ -310,7 +318,7 @@ TEST_F(NetworkConfigurationHandlerTest, GetProperties) {
EXPECT_CALL(*mock_service_client_, GetProperties(_, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties));
- network_configuration_handler_->GetProperties(
+ network_configuration_handler_->GetShillProperties(
service_path,
base::Bind(&DictionaryValueCallback, service_path, expected_json),
base::Bind(&ErrorCallback, false, service_path));
@@ -330,7 +338,7 @@ TEST_F(NetworkConfigurationHandlerTest, SetProperties) {
EXPECT_CALL(*mock_service_client_, SetProperties(_, _, _, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnSetProperties));
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, value, NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&base::DoNothing),
base::Bind(&ErrorCallback, false, service_path));
@@ -351,7 +359,7 @@ TEST_F(NetworkConfigurationHandlerTest, ClearProperties) {
EXPECT_CALL(*mock_service_client_, SetProperties(_, _, _, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnSetProperties));
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, value, NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&base::DoNothing),
base::Bind(&ErrorCallback, false, service_path));
@@ -363,7 +371,7 @@ TEST_F(NetworkConfigurationHandlerTest, ClearProperties) {
EXPECT_CALL(*mock_service_client_, ClearProperties(_, _, _, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnClearProperties));
- network_configuration_handler_->ClearProperties(
+ network_configuration_handler_->ClearShillProperties(
service_path, values_to_clear, base::Bind(&base::DoNothing),
base::Bind(&ErrorCallback, false, service_path));
message_loop_.RunUntilIdle();
@@ -383,7 +391,7 @@ TEST_F(NetworkConfigurationHandlerTest, ClearPropertiesError) {
EXPECT_CALL(*mock_service_client_, SetProperties(_, _, _, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnSetProperties));
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, value, NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&base::DoNothing),
base::Bind(&ErrorCallback, false, service_path));
@@ -395,7 +403,7 @@ TEST_F(NetworkConfigurationHandlerTest, ClearPropertiesError) {
EXPECT_CALL(*mock_service_client_, ClearProperties(_, _, _, _))
.WillOnce(Invoke(
this, &NetworkConfigurationHandlerTest::OnClearPropertiesError));
- network_configuration_handler_->ClearProperties(
+ network_configuration_handler_->ClearShillProperties(
service_path, values_to_clear, base::Bind(&base::DoNothing),
base::Bind(&ErrorCallback, true, service_path));
message_loop_.RunUntilIdle();
@@ -417,10 +425,7 @@ TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) {
ConfigureServiceForProfile(dbus::ObjectPath(profile), _, _, _))
.WillOnce(
Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService));
- network_configuration_handler_->CreateConfiguration(
- value, NetworkConfigurationObserver::SOURCE_USER_ACTION,
- base::Bind(&StringResultCallback, std::string("/service/2")),
- base::Bind(&ErrorCallback, false, std::string()));
+ CreateConfiguration("/service/2", value);
message_loop_.RunUntilIdle();
}
@@ -533,7 +538,7 @@ class NetworkConfigurationHandlerStubTest : public testing::Test {
properties.SetStringWithoutPathExpansion(
shill::kProfileProperty, NetworkProfileHandler::GetSharedProfilePath());
- network_configuration_handler_->CreateConfiguration(
+ network_configuration_handler_->CreateShillConfiguration(
properties, NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(
&NetworkConfigurationHandlerStubTest::CreateConfigurationCallback,
@@ -588,7 +593,7 @@ TEST_F(NetworkConfigurationHandlerStubTest, StubSetAndClearProperties) {
test_identity);
properties_to_set.SetStringWithoutPathExpansion(shill::kPassphraseProperty,
test_passphrase);
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, properties_to_set,
NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&NetworkConfigurationHandlerStubTest::SuccessCallback,
@@ -610,7 +615,7 @@ TEST_F(NetworkConfigurationHandlerStubTest, StubSetAndClearProperties) {
std::vector<std::string> properties_to_clear;
properties_to_clear.push_back(shill::kIdentityProperty);
properties_to_clear.push_back(shill::kPassphraseProperty);
- network_configuration_handler_->ClearProperties(
+ network_configuration_handler_->ClearShillProperties(
service_path, properties_to_clear,
base::Bind(&NetworkConfigurationHandlerStubTest::SuccessCallback,
base::Unretained(this), "ClearProperties"),
@@ -635,7 +640,7 @@ TEST_F(NetworkConfigurationHandlerStubTest, StubGetNameFromWifiHex) {
base::DictionaryValue properties_to_set;
properties_to_set.SetStringWithoutPathExpansion(shill::kWifiHexSsid,
wifi_hex);
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, properties_to_set,
NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&base::DoNothing),
@@ -647,7 +652,7 @@ TEST_F(NetworkConfigurationHandlerStubTest, StubGetNameFromWifiHex) {
EXPECT_EQ(wifi_hex, wifi_hex_result);
// Get Properties
- network_configuration_handler_->GetProperties(
+ network_configuration_handler_->GetShillProperties(
service_path,
base::Bind(&NetworkConfigurationHandlerStubTest::GetPropertiesCallback,
base::Unretained(this)),
@@ -696,7 +701,7 @@ TEST_F(NetworkConfigurationHandlerStubTest, NetworkConfigurationObserver) {
base::DictionaryValue properties_to_set;
properties_to_set.SetStringWithoutPathExpansion(shill::kPassphraseProperty,
test_passphrase);
- network_configuration_handler_->SetProperties(
+ network_configuration_handler_->SetShillProperties(
service_path, properties_to_set,
NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&base::DoNothing),
diff --git a/chromeos/network/network_connection_handler.cc b/chromeos/network/network_connection_handler.cc
index af9f26a..21d23be 100644
--- a/chromeos/network/network_connection_handler.cc
+++ b/chromeos/network/network_connection_handler.cc
@@ -293,7 +293,7 @@ void NetworkConnectionHandler::ConnectToNetwork(
// Request additional properties to check. VerifyConfiguredAndConnect will
// use only these properties, not cached properties, to ensure that they
// are up to date after any recent configuration.
- configuration_handler_->GetProperties(
+ configuration_handler_->GetShillProperties(
service_path,
base::Bind(&NetworkConnectionHandler::VerifyConfiguredAndConnect,
AsWeakPtr(), check_error_state),
@@ -504,16 +504,13 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect(
if (!config_properties.empty()) {
NET_LOG_EVENT("Configuring Network", service_path);
- configuration_handler_->SetProperties(
- service_path,
- config_properties,
+ configuration_handler_->SetShillProperties(
+ service_path, config_properties,
NetworkConfigurationObserver::SOURCE_USER_ACTION,
- base::Bind(&NetworkConnectionHandler::CallShillConnect,
- AsWeakPtr(),
+ base::Bind(&NetworkConnectionHandler::CallShillConnect, AsWeakPtr(),
service_path),
base::Bind(&NetworkConnectionHandler::HandleConfigurationFailure,
- AsWeakPtr(),
- service_path));
+ AsWeakPtr(), service_path));
return;
}
diff --git a/components/metrics/net/wifi_access_point_info_provider_chromeos.cc b/components/metrics/net/wifi_access_point_info_provider_chromeos.cc
index cb0adf1..16471bc 100644
--- a/components/metrics/net/wifi_access_point_info_provider_chromeos.cc
+++ b/components/metrics/net/wifi_access_point_info_provider_chromeos.cc
@@ -51,10 +51,9 @@ void WifiAccessPointInfoProviderChromeos::DefaultNetworkChanged(
return;
// Retrieve access point info for wifi connection.
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
default_network->path(),
- base::Bind(&WifiAccessPointInfoProviderChromeos::ParseInfo,
- AsWeakPtr()),
+ base::Bind(&WifiAccessPointInfoProviderChromeos::ParseInfo, AsWeakPtr()),
chromeos::network_handler::ErrorCallback());
}
diff --git a/extensions/browser/api/vpn_provider/vpn_service.cc b/extensions/browser/api/vpn_provider/vpn_service.cc
index 2ebc3ff..7a51aac 100644
--- a/extensions/browser/api/vpn_provider/vpn_service.cc
+++ b/extensions/browser/api/vpn_provider/vpn_service.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/guid.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -263,7 +264,7 @@ void VpnService::NetworkListChanged() {
continue;
}
- network_configuration_handler_->GetProperties(
+ network_configuration_handler_->GetShillProperties(
iter->path(), base::Bind(&VpnService::OnGetPropertiesSuccess,
weak_factory_.GetWeakPtr()),
base::Bind(&VpnService::OnGetPropertiesFailure,
@@ -316,7 +317,12 @@ void VpnService::CreateConfiguration(const std::string& extension_id,
properties.SetStringWithoutPathExpansion(shill::kConfigurationNameProperty,
configuration_name);
- network_configuration_handler_->CreateConfiguration(
+ // Note: This will not create an entry in |policy_util|. TODO(pneubeck):
+ // Determine the correct thing to do here, crbug.com/459278.
+ std::string guid = base::GenerateGUID();
+ properties.SetStringWithoutPathExpansion(shill::kGuidProperty, guid);
+
+ network_configuration_handler_->CreateShillConfiguration(
properties, NetworkConfigurationObserver::SOURCE_EXTENSION_INSTALL,
base::Bind(&VpnService::OnCreateConfigurationSuccess,
weak_factory_.GetWeakPtr(), success, configuration),
diff --git a/ui/chromeos/network/network_connect.cc b/ui/chromeos/network/network_connect.cc
index 0d9a3e9..bc9f02e 100644
--- a/ui/chromeos/network/network_connect.cc
+++ b/ui/chromeos/network/network_connect.cc
@@ -68,11 +68,11 @@ class NetworkConnectImpl : public NetworkConnect {
void ActivateCellular(const std::string& service_path) override;
void ShowMobileSetup(const std::string& service_path) override;
void ConfigureNetworkAndConnect(const std::string& service_path,
- const base::DictionaryValue& properties,
+ const base::DictionaryValue& shill_properties,
bool shared) override;
- void CreateConfigurationAndConnect(base::DictionaryValue* properties,
+ void CreateConfigurationAndConnect(base::DictionaryValue* shill_properties,
bool shared) override;
- void CreateConfiguration(base::DictionaryValue* properties,
+ void CreateConfiguration(base::DictionaryValue* shill_properties,
bool shared) override;
base::string16 GetShillErrorString(const std::string& error,
const std::string& service_path) override;
@@ -290,7 +290,7 @@ void NetworkConnectImpl::OnConfigureSucceeded(bool connect_on_configure,
}
void NetworkConnectImpl::CallCreateConfiguration(
- base::DictionaryValue* properties,
+ base::DictionaryValue* shill_properties,
bool shared,
bool connect_on_configure) {
std::string profile_path;
@@ -299,14 +299,16 @@ void NetworkConnectImpl::CallCreateConfiguration(
NetworkConnectionHandler::kErrorConfigureFailed, "");
return;
}
- properties->SetStringWithoutPathExpansion(shill::kProfileProperty,
- profile_path);
- NetworkHandler::Get()->network_configuration_handler()->CreateConfiguration(
- *properties, NetworkConfigurationObserver::SOURCE_USER_ACTION,
- base::Bind(&NetworkConnectImpl::OnConfigureSucceeded,
- weak_factory_.GetWeakPtr(), connect_on_configure),
- base::Bind(&NetworkConnectImpl::OnConfigureFailed,
- weak_factory_.GetWeakPtr()));
+ shill_properties->SetStringWithoutPathExpansion(shill::kProfileProperty,
+ profile_path);
+ NetworkHandler::Get()
+ ->network_configuration_handler()
+ ->CreateShillConfiguration(
+ *shill_properties, NetworkConfigurationObserver::SOURCE_USER_ACTION,
+ base::Bind(&NetworkConnectImpl::OnConfigureSucceeded,
+ weak_factory_.GetWeakPtr(), connect_on_configure),
+ base::Bind(&NetworkConnectImpl::OnConfigureFailed,
+ weak_factory_.GetWeakPtr()));
}
void NetworkConnectImpl::SetPropertiesFailed(
@@ -342,7 +344,7 @@ void NetworkConnectImpl::ClearPropertiesAndConnect(
NET_LOG_USER("ClearPropertiesAndConnect", service_path);
// After configuring a network, ignore any (possibly stale) error state.
const bool check_error_state = false;
- NetworkHandler::Get()->network_configuration_handler()->ClearProperties(
+ NetworkHandler::Get()->network_configuration_handler()->ClearShillProperties(
service_path, properties_to_clear,
base::Bind(&NetworkConnectImpl::CallConnectToNetwork,
weak_factory_.GetWeakPtr(), service_path, check_error_state),
@@ -355,7 +357,7 @@ void NetworkConnectImpl::ConfigureSetProfileSucceeded(
scoped_ptr<base::DictionaryValue> properties_to_set) {
std::vector<std::string> properties_to_clear;
SetPropertiesToClear(properties_to_set.get(), &properties_to_clear);
- NetworkHandler::Get()->network_configuration_handler()->SetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->SetShillProperties(
service_path, *properties_to_set,
NetworkConfigurationObserver::SOURCE_USER_ACTION,
base::Bind(&NetworkConnectImpl::ClearPropertiesAndConnect,
diff --git a/ui/chromeos/network/network_connect.h b/ui/chromeos/network/network_connect.h
index 80ed818..540f1ff 100644
--- a/ui/chromeos/network/network_connect.h
+++ b/ui/chromeos/network/network_connect.h
@@ -81,18 +81,19 @@ class UI_CHROMEOS_EXPORT NetworkConnect {
// connect request. The profile is set according to 'shared' if allowed.
virtual void ConfigureNetworkAndConnect(
const std::string& service_path,
- const base::DictionaryValue& properties,
+ const base::DictionaryValue& shill_properties,
bool shared) = 0;
// Requests a new network configuration to be created from a dictionary of
// Shill properties and sends a connect request if the configuration succeeds.
// The profile used is determined by |shared|.
- virtual void CreateConfigurationAndConnect(base::DictionaryValue* properties,
- bool shared) = 0;
+ virtual void CreateConfigurationAndConnect(
+ base::DictionaryValue* shill_properties,
+ bool shared) = 0;
// Requests a new network configuration to be created from a dictionary of
// Shill properties. The profile used is determined by |shared|.
- virtual void CreateConfiguration(base::DictionaryValue* properties,
+ virtual void CreateConfiguration(base::DictionaryValue* shill_properties,
bool shared) = 0;
// Returns the localized string for shill error string |error|.
diff --git a/ui/chromeos/network/network_state_notifier.cc b/ui/chromeos/network/network_state_notifier.cc
index eb211c2..0cfde4a 100644
--- a/ui/chromeos/network/network_state_notifier.cc
+++ b/ui/chromeos/network/network_state_notifier.cc
@@ -231,7 +231,7 @@ void NetworkStateNotifier::ShowNetworkConnectError(
return;
}
// Get the up-to-date properties for the network and display the error.
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
service_path,
base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesSucceeded,
weak_ptr_factory_.GetWeakPtr(), error_name),