summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/shill_service_client_stub.cc
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 20:35:07 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 20:35:07 +0000
commit79affb7effb751deed7336a1828de3cdc1fdde04 (patch)
tree8cf54f6061fd99dd1d4d43f491ea3f3164965613 /chromeos/dbus/shill_service_client_stub.cc
parenteda0a0b16697dab1fc2d45d6cfe38652044b88d5 (diff)
downloadchromium_src-79affb7effb751deed7336a1828de3cdc1fdde04.zip
chromium_src-79affb7effb751deed7336a1828de3cdc1fdde04.tar.gz
chromium_src-79affb7effb751deed7336a1828de3cdc1fdde04.tar.bz2
Adding policy support to the new network configuration stack.
Adapts in particular the ManagedNetworkConfigurationHandler, the networkingPrivate extension API and the network configuration extension. BUG=223869 TBR=thestig@chromium.org (for chrome_browser_chromeos.gypi) Review URL: https://chromiumcodereview.appspot.com/12676017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/shill_service_client_stub.cc')
-rw-r--r--chromeos/dbus/shill_service_client_stub.cc47
1 files changed, 29 insertions, 18 deletions
diff --git a/chromeos/dbus/shill_service_client_stub.cc b/chromeos/dbus/shill_service_client_stub.cc
index 3b8f1de..677f9d6 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) {