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

Unified Diff: chromeos/dbus/nfc_client_helpers.cc

Issue 221393004: dbus/values_util.h: Add functions to append collection type values to message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed keybuk@'s comment, unmarked old functions as deprecated as they are useful. Created 6 years, 9 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/nfc_client_helpers.h ('k') | chromeos/dbus/nfc_device_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/nfc_client_helpers.cc
diff --git a/chromeos/dbus/nfc_client_helpers.cc b/chromeos/dbus/nfc_client_helpers.cc
index b99502bc9ee4b76f2d49e7b1166239dc887de371..1469d26d27ef9744e4bdb8308b15134fca8a73bf 100644
--- a/chromeos/dbus/nfc_client_helpers.cc
+++ b/chromeos/dbus/nfc_client_helpers.cc
@@ -34,55 +34,6 @@ void OnError(const ErrorCallback& error_callback,
error_callback.Run(error_name, error_message);
}
-void AppendValueDataAsVariant(dbus::MessageWriter* writer,
- const base::Value& value) {
- switch (value.GetType()) {
- case base::Value::TYPE_DICTIONARY: {
- const base::DictionaryValue* dictionary = NULL;
- value.GetAsDictionary(&dictionary);
- dbus::MessageWriter variant_writer(NULL);
- dbus::MessageWriter array_writer(NULL);
- writer->OpenVariant("a{sv}", &variant_writer);
- variant_writer.OpenArray("{sv}", &array_writer);
- for (base::DictionaryValue::Iterator iter(*dictionary);
- !iter.IsAtEnd(); iter.Advance()) {
- dbus::MessageWriter entry_writer(NULL);
- array_writer.OpenDictEntry(&entry_writer);
- entry_writer.AppendString(iter.key());
- AppendValueDataAsVariant(&entry_writer, iter.value());
- array_writer.CloseContainer(&entry_writer);
- }
- variant_writer.CloseContainer(&array_writer);
- writer->CloseContainer(&variant_writer);
- break;
- }
- case base::Value::TYPE_LIST: {
- const base::ListValue* list = NULL;
- value.GetAsList(&list);
- dbus::MessageWriter variant_writer(NULL);
- dbus::MessageWriter array_writer(NULL);
- writer->OpenVariant("av", &variant_writer);
- variant_writer.OpenArray("v", &array_writer);
- for (base::ListValue::const_iterator iter = list->begin();
- iter != list->end(); ++iter) {
- const base::Value* value = *iter;
- AppendValueDataAsVariant(&array_writer, *value);
- }
- variant_writer.CloseContainer(&array_writer);
- writer->CloseContainer(&variant_writer);
- break;
- }
- case base::Value::TYPE_BOOLEAN:
- case base::Value::TYPE_INTEGER:
- case base::Value::TYPE_DOUBLE:
- case base::Value::TYPE_STRING:
- dbus::AppendBasicTypeValueDataAsVariant(writer, value);
- break;
- default:
- DLOG(ERROR) << "Unexpected type: " << value.GetType();
- }
-}
-
DBusObjectMap::DBusObjectMap(const std::string& service_name,
Delegate* delegate,
dbus::Bus* bus)
« no previous file with comments | « chromeos/dbus/nfc_client_helpers.h ('k') | chromeos/dbus/nfc_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698