OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const ErrorCallback& error_callback); | 134 const ErrorCallback& error_callback); |
135 | 135 |
136 // Calls a method with a boolean array result with error callback. | 136 // Calls a method with a boolean array result with error callback. |
137 void CallListValueMethodWithErrorCallback( | 137 void CallListValueMethodWithErrorCallback( |
138 dbus::MethodCall* method_call, | 138 dbus::MethodCall* method_call, |
139 const ListValueCallback& callback, | 139 const ListValueCallback& callback, |
140 const ErrorCallback& error_callback); | 140 const ErrorCallback& error_callback); |
141 | 141 |
142 const dbus::ObjectProxy* object_proxy() const { return proxy_; } | 142 const dbus::ObjectProxy* object_proxy() const { return proxy_; } |
143 | 143 |
144 // Appends the value (basic types and string-to-string dictionary) to the | 144 // Appends the value to the writer as a variant. If |value| is a Dictionary it |
145 // writer as a variant. | 145 // will be written as a string -> varient dictionary, a{sv}. If |value| is a |
| 146 // List then it must be a List of String values and is writen as type 'as'. |
146 static void AppendValueDataAsVariant(dbus::MessageWriter* writer, | 147 static void AppendValueDataAsVariant(dbus::MessageWriter* writer, |
147 const base::Value& value); | 148 const base::Value& value); |
148 | 149 |
149 // Appends a string-to-variant dictionary to the writer. | 150 // As above but if |use_string_dictionaries| is true and |value| is a |
150 static void AppendServicePropertiesDictionary( | 151 // Dictionary then it will be wtitten as type 'a{ss}'. (This is to support |
151 dbus::MessageWriter* writer, | 152 // Cellular.APN which expects a string -> string dictionary). |
152 const base::DictionaryValue& dictionary); | 153 static void AppendValueDataAsVariantEx(dbus::MessageWriter* writer, |
| 154 const base::Value& value, |
| 155 bool use_string_dictionaries); |
| 156 |
| 157 // Appends a string-to-variant dictionary to the writer as an '{sv}' array. |
| 158 // Each value is written using AppendValueDataAsVariant. |
| 159 static void AppendServicePropertiesDictionary(dbus::MessageWriter* writer, |
| 160 const base::DictionaryValue&); |
153 | 161 |
154 protected: | 162 protected: |
155 // Reference / Ownership management. If the number of active refs (observers | 163 // Reference / Ownership management. If the number of active refs (observers |
156 // + in-progress method calls) becomes 0, |released_callback_| (if set) will | 164 // + in-progress method calls) becomes 0, |released_callback_| (if set) will |
157 // be called. | 165 // be called. |
158 void AddRef(); | 166 void AddRef(); |
159 void Release(); | 167 void Release(); |
160 | 168 |
161 private: | 169 private: |
162 // Starts monitoring PropertyChanged signal. | 170 // Starts monitoring PropertyChanged signal. |
(...skipping 18 matching lines...) Expand all Loading... |
181 // Note: This should remain the last member so it'll be destroyed and | 189 // Note: This should remain the last member so it'll be destroyed and |
182 // invalidate its weak pointers before any other members are destroyed. | 190 // invalidate its weak pointers before any other members are destroyed. |
183 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; | 191 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; |
184 | 192 |
185 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); | 193 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); |
186 }; | 194 }; |
187 | 195 |
188 } // namespace chromeos | 196 } // namespace chromeos |
189 | 197 |
190 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 198 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
OLD | NEW |