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

Unified Diff: chrome/browser/chromeos/extensions/networking_private_api.cc

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove policy initialized flags and wrap PolicyMaps with scoped_ptr. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/networking_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/networking_private_api.cc b/chrome/browser/chromeos/extensions/networking_private_api.cc
index 1d065f229f346039a9bf88e6f1c111d9a2e2d387..57033a812bff598a3139f2e3534bb3b7053fbd70 100644
--- a/chrome/browser/chromeos/extensions/networking_private_api.cc
+++ b/chrome/browser/chromeos/extensions/networking_private_api.cc
@@ -37,9 +37,8 @@ bool NetworkingPrivateGetPropertiesFunction::RunImpl() {
ManagedNetworkConfigurationHandler::Get()->GetProperties(
service_path,
- base::Bind(
- &NetworkingPrivateGetPropertiesFunction::GetPropertiesSuccess,
- this),
+ base::Bind(&NetworkingPrivateGetPropertiesFunction::GetPropertiesSuccess,
+ this),
base::Bind(&NetworkingPrivateGetPropertiesFunction::GetPropertiesFailed,
this));
return true;
@@ -63,6 +62,46 @@ void NetworkingPrivateGetPropertiesFunction::GetPropertiesFailed(
}
////////////////////////////////////////////////////////////////////////////////
+// NetworkingPrivateGetManagedPropertiesFunction
+
+NetworkingPrivateGetManagedPropertiesFunction::
+ ~NetworkingPrivateGetManagedPropertiesFunction() {
+}
+
+bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() {
+ scoped_ptr<api::GetManagedProperties::Params> params =
+ api::GetManagedProperties::Params::Create(*args_);
+ EXTENSION_FUNCTION_VALIDATE(params);
+ // The |network_guid| parameter is storing the service path.
+ std::string service_path = params->network_guid;
+
+ ManagedNetworkConfigurationHandler::Get()->GetManagedProperties(
+ service_path,
+ base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success,
+ this),
+ base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure,
+ this));
+ return true;
+}
+
+void NetworkingPrivateGetManagedPropertiesFunction::Success(
+ const std::string& service_path,
+ const base::DictionaryValue& dictionary) {
+ base::DictionaryValue* network_properties = dictionary.DeepCopy();
+ network_properties->SetStringWithoutPathExpansion(onc::network_config::kGUID,
+ service_path);
+ SetResult(network_properties);
+ SendResponse(true);
+}
+
+void NetworkingPrivateGetManagedPropertiesFunction::Failure(
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data) {
+ error_ = error_name;
+ SendResponse(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// NetworkingPrivateGetStateFunction
NetworkingPrivateGetStateFunction::
@@ -109,8 +148,11 @@ bool NetworkingPrivateSetPropertiesFunction::RunImpl() {
scoped_ptr<base::DictionaryValue> properties_dict(
params->properties.ToValue());
+ // The |network_guid| parameter is storing the service path.
pastarmovj 2013/04/11 14:46:29 Is there any other reason to create a temp here ot
pneubeck (no reviews) 2013/04/15 12:16:24 No other reason. If just found it harder to miss i
+ std::string service_path = params->network_guid;
+
ManagedNetworkConfigurationHandler::Get()->SetProperties(
- params->network_guid,
+ service_path,
*properties_dict,
base::Bind(&NetworkingPrivateSetPropertiesFunction::ResultCallback,
this),

Powered by Google App Engine
This is Rietveld 408576698