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

Unified Diff: chromeos/dbus/shill_service_client_stub.cc

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. 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
« no previous file with comments | « chromeos/dbus/shill_service_client_stub.h ('k') | chromeos/network/managed_network_configuration_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/shill_service_client_stub.cc
diff --git a/chromeos/dbus/shill_service_client_stub.cc b/chromeos/dbus/shill_service_client_stub.cc
index 3b8f1de0e7eee46dc2b9deadbaed18990fffff43..677f9d651a61168b341a871851e88a24457948d3 100644
--- a/chromeos/dbus/shill_service_client_stub.cc
+++ b/chromeos/dbus/shill_service_client_stub.cc
@@ -32,6 +32,13 @@ void PassStubListValue(const ShillServiceClient::ListValueCallback& callback,
callback.Run(*value);
}
+void PassStubServiceProperties(
+ const ShillServiceClient::DictionaryValueCallback& callback,
+ DBusMethodCallStatus call_status,
+ const base::DictionaryValue* properties) {
+ callback.Run(call_status, *properties);
+}
+
} // namespace
ShillServiceClientStub::ShillServiceClientStub() : weak_ptr_factory_(this) {
@@ -62,12 +69,29 @@ void ShillServiceClientStub::GetProperties(
const DictionaryValueCallback& callback) {
if (callback.is_null())
return;
+
+ base::DictionaryValue* nested_dict = NULL;
+ scoped_ptr<base::DictionaryValue> result_properties;
+ DBusMethodCallStatus call_status;
+ stub_services_.GetDictionaryWithoutPathExpansion(service_path.value(),
+ &nested_dict);
+ if (nested_dict) {
+ result_properties.reset(nested_dict->DeepCopy());
+ // Remove credentials that Shill wouldn't send.
+ result_properties->RemoveWithoutPathExpansion(flimflam::kPassphraseProperty,
+ NULL);
+ call_status = DBUS_METHOD_CALL_SUCCESS;
+ } else {
+ result_properties.reset(new base::DictionaryValue);
+ call_status = DBUS_METHOD_CALL_FAILURE;
+ }
+
MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&ShillServiceClientStub::PassStubServiceProperties,
- weak_ptr_factory_.GetWeakPtr(),
- service_path,
- callback));
+ base::Bind(&PassStubServiceProperties,
+ callback,
+ call_status,
+ base::Owned(result_properties.release())));
}
void ShillServiceClientStub::SetProperty(const dbus::ObjectPath& service_path,
@@ -77,7 +101,7 @@ void ShillServiceClientStub::SetProperty(const dbus::ObjectPath& service_path,
const ErrorCallback& error_callback) {
base::DictionaryValue* dict = NULL;
if (!stub_services_.GetDictionaryWithoutPathExpansion(
- service_path.value(), &dict)) {
+ service_path.value(), &dict)) {
error_callback.Run("Error.InvalidService", "Invalid Service");
return;
}
@@ -374,19 +398,6 @@ void ShillServiceClientStub::SetDefaultProperties() {
add_to_watchlist);
}
-void ShillServiceClientStub::PassStubServiceProperties(
- const dbus::ObjectPath& service_path,
- const DictionaryValueCallback& callback) {
- base::DictionaryValue* dict = NULL;
- if (!stub_services_.GetDictionaryWithoutPathExpansion(
- service_path.value(), &dict)) {
- base::DictionaryValue empty_dictionary;
- callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary);
- return;
- }
- callback.Run(DBUS_METHOD_CALL_SUCCESS, *dict);
-}
-
void ShillServiceClientStub::NotifyObserversPropertyChanged(
const dbus::ObjectPath& service_path,
const std::string& property) {
« no previous file with comments | « chromeos/dbus/shill_service_client_stub.h ('k') | chromeos/network/managed_network_configuration_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698