OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/nfc_tag_client.h" | 5 #include "chromeos/dbus/nfc_tag_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 error_callback.Run(nfc_error::kInvalidArguments, error_message); | 95 error_callback.Run(nfc_error::kInvalidArguments, error_message); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 // Create the arguments. | 99 // Create the arguments. |
100 dbus::MethodCall method_call(nfc_tag::kNfcTagInterface, nfc_tag::kWrite); | 100 dbus::MethodCall method_call(nfc_tag::kNfcTagInterface, nfc_tag::kWrite); |
101 dbus::MessageWriter writer(&method_call); | 101 dbus::MessageWriter writer(&method_call); |
102 dbus::MessageWriter array_writer(NULL); | 102 dbus::MessageWriter array_writer(NULL); |
103 dbus::MessageWriter dict_entry_writer(NULL); | 103 dbus::MessageWriter dict_entry_writer(NULL); |
104 writer.OpenArray("{sv}", &array_writer); | 104 writer.OpenArray("{sv}", &array_writer); |
105 for (DictionaryValue::Iterator iter(attributes); | 105 for (base::DictionaryValue::Iterator iter(attributes); |
106 !iter.IsAtEnd(); iter.Advance()) { | 106 !iter.IsAtEnd(); iter.Advance()) { |
107 array_writer.OpenDictEntry(&dict_entry_writer); | 107 array_writer.OpenDictEntry(&dict_entry_writer); |
108 dict_entry_writer.AppendString(iter.key()); | 108 dict_entry_writer.AppendString(iter.key()); |
109 nfc_client_helpers::AppendValueDataAsVariant(&dict_entry_writer, | 109 nfc_client_helpers::AppendValueDataAsVariant(&dict_entry_writer, |
110 iter.value()); | 110 iter.value()); |
111 array_writer.CloseContainer(&dict_entry_writer); | 111 array_writer.CloseContainer(&dict_entry_writer); |
112 } | 112 } |
113 writer.CloseContainer(&array_writer); | 113 writer.CloseContainer(&array_writer); |
114 | 114 |
115 object_proxy->CallMethodWithErrorCallback( | 115 object_proxy->CallMethodWithErrorCallback( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 NfcTagClient::~NfcTagClient() { | 240 NfcTagClient::~NfcTagClient() { |
241 } | 241 } |
242 | 242 |
243 NfcTagClient* NfcTagClient::Create(NfcAdapterClient* adapter_client) { | 243 NfcTagClient* NfcTagClient::Create(NfcAdapterClient* adapter_client) { |
244 return new NfcTagClientImpl(adapter_client); | 244 return new NfcTagClientImpl(adapter_client); |
245 } | 245 } |
246 | 246 |
247 } // namespace chromeos | 247 } // namespace chromeos |
OLD | NEW |