Upload upstream chromium 73.0.3683.0
[platform/framework/web/chromium-efl.git] / dbus / property.h
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
3 // found in the LICENSE file.
4
5 #ifndef DBUS_PROPERTY_H_
6 #define DBUS_PROPERTY_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <string>
12 #include <utility>
13 #include <vector>
14
15 #include "base/bind.h"
16 #include "base/callback.h"
17 #include "base/macros.h"
18 #include "dbus/dbus_export.h"
19 #include "dbus/message.h"
20 #include "dbus/object_proxy.h"
21
22 // D-Bus objects frequently provide sets of properties accessed via a
23 // standard interface of method calls and signals to obtain the current value,
24 // set a new value and be notified of changes to the value. Unfortunately this
25 // interface makes heavy use of variants and dictionaries of variants. The
26 // classes defined here make dealing with properties in a type-safe manner
27 // possible.
28 //
29 // Client implementation classes should define a Properties structure, deriving
30 // from the PropertySet class defined here. This structure should contain a
31 // member for each property defined as an instance of the Property<> class,
32 // specifying the type to the template. Finally the structure should chain up
33 // to the PropertySet constructor, and then call RegisterProperty() for each
34 // property defined to associate them with their string name.
35 //
36 // Example:
37 //   class ExampleClient {
38 //    public:
39 //     struct Properties : public dbus::PropertySet {
40 //       dbus::Property<std::string> name;
41 //       dbus::Property<uint16_t> version;
42 //       dbus::Property<dbus::ObjectPath> parent;
43 //       dbus::Property<std::vector<std::string>> children;
44 //
45 //       Properties(dbus::ObjectProxy* object_proxy,
46 //                  const PropertyChangedCallback callback)
47 //           : dbus::PropertySet(object_proxy, "com.example.DBus", callback) {
48 //         RegisterProperty("Name", &name);
49 //         RegisterProperty("Version", &version);
50 //         RegisterProperty("Parent", &parent);
51 //         RegisterProperty("Children", &children);
52 //       }
53 //       virtual ~Properties() {}
54 //     };
55 //
56 // The Properties structure requires a pointer to the object proxy of the
57 // actual object to track, and after construction should have signals
58 // connected to that object and initial values set by calling ConnectSignals()
59 // and GetAll(). The structure should not outlive the object proxy, so it
60 // is recommended that the lifecycle of both be managed together.
61 //
62 // Example (continued):
63 //
64 //     typedef std::map<std::pair<dbus::ObjectProxy*, Properties*>> Object;
65 //     typedef std::map<dbus::ObjectPath, Object> ObjectMap;
66 //     ObjectMap object_map_;
67 //
68 //     dbus::ObjectProxy* GetObjectProxy(const dbus::ObjectPath& object_path) {
69 //       return GetObject(object_path).first;
70 //     }
71 //
72 //     Properties* GetProperties(const dbus::ObjectPath& object_path) {
73 //       return GetObject(object_path).second;
74 //     }
75 //
76 //     Object GetObject(const dbus::ObjectPath& object_path) {
77 //       ObjectMap::iterator it = object_map_.find(object_path);
78 //       if (it != object_map_.end())
79 //         return it->second;
80 //
81 //       dbus::ObjectProxy* object_proxy = bus->GetObjectProxy(...);
82 //       // connect signals, etc.
83 //
84 //       Properties* properties = new Properties(
85 //           object_proxy,
86 //           base::Bind(&PropertyChanged,
87 //                      weak_ptr_factory_.GetWeakPtr(),
88 //                      object_path));
89 //       properties->ConnectSignals();
90 //       properties->GetAll();
91 //
92 //       Object object = std::make_pair(object_proxy, properties);
93 //       object_map_[object_path] = object;
94 //       return object;
95 //     }
96 //  };
97 //
98 // This now allows code using the client implementation to access properties
99 // in a type-safe manner, and assuming the PropertyChanged callback is
100 // propogated up to observers, be notified of changes. A typical access of
101 // the current value of the name property would be:
102 //
103 //   ExampleClient::Properties* p = example_client->GetProperties(object_path);
104 //   std::string name = p->name.value();
105 //
106 // Normally these values are updated from signals emitted by the remote object,
107 // in case an explicit round-trip is needed to obtain the current value, the
108 // Get() method can be used and indicates whether or not the value update was
109 // successful. The updated value can be obtained in the callback using the
110 // value() method.
111 //
112 //   p->children.Get(base::Bind(&OnGetChildren));
113 //
114 // A new value can be set using the Set() method, the callback indicates
115 // success only; it is up to the remote object when (and indeed if) it updates
116 // the property value, and whether it emits a signal or a Get() call is
117 // required to obtain it.
118 //
119 //   p->version.Set(20, base::Bind(&OnSetVersion))
120
121 namespace dbus {
122
123 // D-Bus Properties interface constants, declared here rather than
124 // in property.cc because template methods use them.
125 const char kPropertiesInterface[] = "org.freedesktop.DBus.Properties";
126 const char kPropertiesGetAll[] = "GetAll";
127 const char kPropertiesGet[] = "Get";
128 const char kPropertiesSet[] = "Set";
129 const char kPropertiesChanged[] = "PropertiesChanged";
130
131 class PropertySet;
132
133 // PropertyBase is an abstract base-class consisting of the parts of
134 // the Property<> template that are not type-specific, such as the
135 // associated PropertySet, property name, and the type-unsafe parts
136 // used by PropertySet.
137 class CHROME_DBUS_EXPORT PropertyBase {
138  public:
139   PropertyBase();
140   virtual ~PropertyBase();
141
142   // Initializes the |property_set| and property |name| so that method
143   // calls may be made from this class. This method is called by
144   // PropertySet::RegisterProperty() passing |this| for |property_set| so
145   // there should be no need to call it directly. If you do beware that
146   // no ownership or reference to |property_set| is taken so that object
147   // must outlive this one.
148   void Init(PropertySet* property_set, const std::string& name);
149
150   // Retrieves the name of this property, this may be useful in observers
151   // to avoid specifying the name in more than once place, e.g.
152   //
153   //   void Client::PropertyChanged(const dbus::ObjectPath& object_path,
154   //                                const std::string &property_name) {
155   //     Properties& properties = GetProperties(object_path);
156   //     if (property_name == properties.version.name()) {
157   //       // Handle version property changing
158   //     }
159   //   }
160   const std::string& name() const { return name_; }
161
162   // Returns true if property is valid, false otherwise.
163   bool is_valid() const { return is_valid_; }
164
165   // Allows to mark Property as valid or invalid.
166   void set_valid(bool is_valid) { is_valid_ = is_valid; }
167
168   // Method used by PropertySet to retrieve the value from a MessageReader,
169   // no knowledge of the contained type is required, this method returns
170   // true if its expected type was found, false if not.
171   // Implementation provided by specialization.
172   virtual bool PopValueFromReader(MessageReader* reader) = 0;
173
174   // Method used by PropertySet to append the set value to a MessageWriter,
175   // no knowledge of the contained type is required.
176   // Implementation provided by specialization.
177   virtual void AppendSetValueToWriter(MessageWriter* writer) = 0;
178
179   // Method used by test and stub implementations of dbus::PropertySet::Set
180   // to replace the property value with the set value without using a
181   // dbus::MessageReader.
182   virtual void ReplaceValueWithSetValue() = 0;
183
184  protected:
185   // Retrieves the associated property set.
186   PropertySet* property_set() { return property_set_; }
187
188  private:
189   // Pointer to the PropertySet instance that this instance is a member of,
190   // no ownership is taken and |property_set_| must outlive this class.
191   PropertySet* property_set_;
192
193   bool is_valid_;
194
195   // Name of the property.
196   std::string name_;
197
198   DISALLOW_COPY_AND_ASSIGN(PropertyBase);
199 };
200
201 // PropertySet groups a collection of properties for a remote object
202 // together into a single structure, fixing their types and name such
203 // that calls made through it are type-safe.
204 //
205 // Clients always sub-class this to add the properties, and should always
206 // provide a constructor that chains up to this and then calls
207 // RegisterProperty() for each property defined.
208 //
209 // After creation, client code should call ConnectSignals() and most likely
210 // GetAll() to seed initial values and update as changes occur.
211 class CHROME_DBUS_EXPORT PropertySet {
212  public:
213   // Callback for changes to cached values of properties, either notified
214   // via signal, or as a result of calls to Get() and GetAll(). The |name|
215   // argument specifies the name of the property changed.
216   typedef base::Callback<void(const std::string& name)> PropertyChangedCallback;
217
218   // Constructs a property set, where |object_proxy| specifies the proxy for
219   // the/ remote object that these properties are for, care should be taken to
220   // ensure that this object does not outlive the lifetime of the proxy;
221   // |interface| specifies the D-Bus interface of these properties, and
222   // |property_changed_callback| specifies the callback for when properties
223   // are changed, this may be a NULL callback.
224   PropertySet(ObjectProxy* object_proxy, const std::string& interface,
225               const PropertyChangedCallback& property_changed_callback);
226
227   // Destructor; we don't hold on to any references or memory that needs
228   // explicit clean-up, but clang thinks we might.
229   virtual ~PropertySet();
230
231   // Registers a property, generally called from the subclass constructor;
232   // pass the |name| of the property as used in method calls and signals,
233   // and the pointer to the |property| member of the structure. This will
234   // call the PropertyBase::Init method.
235   void RegisterProperty(const std::string& name, PropertyBase* property);
236
237   // Connects property change notification signals to the object, generally
238   // called immediately after the object is created and before calls to other
239   // methods. Sub-classes may override to use different D-Bus signals.
240   virtual void ConnectSignals();
241
242   // Methods connected by ConnectSignals() and called by dbus:: when
243   // a property is changed. Sub-classes may override if the property
244   // changed signal provides different arguments.
245   virtual void ChangedReceived(Signal* signal);
246   virtual void ChangedConnected(const std::string& interface_name,
247                                 const std::string& signal_name,
248                                 bool success);
249
250   // Callback for Get() method, |success| indicates whether or not the
251   // value could be retrived, if true the new value can be obtained by
252   // calling value() on the property.
253   typedef base::Callback<void(bool success)> GetCallback;
254
255   // Requests an updated value from the remote object for |property|
256   // incurring a round-trip. |callback| will be called when the new
257   // value is available. This may not be implemented by some interfaces,
258   // and may be overriden by sub-classes if interfaces use different
259   // method calls.
260   virtual void Get(PropertyBase* property, GetCallback callback);
261   virtual void OnGet(PropertyBase* property, GetCallback callback,
262                      Response* response);
263
264   // The synchronous version of Get().
265   // This should never be used on an interactive thread.
266   virtual bool GetAndBlock(PropertyBase* property);
267
268   // Queries the remote object for values of all properties and updates
269   // initial values. Sub-classes may override to use a different D-Bus
270   // method, or if the remote object does not support retrieving all
271   // properties, either ignore or obtain each property value individually.
272   virtual void GetAll();
273   virtual void OnGetAll(Response* response);
274
275   // Callback for Set() method, |success| indicates whether or not the
276   // new property value was accepted by the remote object.
277   typedef base::Callback<void(bool success)> SetCallback;
278
279   // Requests that the remote object for |property| change the property to
280   // its new value. |callback| will be called to indicate the success or
281   // failure of the request, however the new value may not be available
282   // depending on the remote object. This method may be overridden by
283   // sub-classes if interfaces use different method calls.
284   virtual void Set(PropertyBase* property, SetCallback callback);
285   virtual void OnSet(PropertyBase* property, SetCallback callback,
286                      Response* response);
287
288   // The synchronous version of Set().
289   // This should never be used on an interactive thread.
290   virtual bool SetAndBlock(PropertyBase* property);
291
292   // Update properties by reading an array of dictionary entries, each
293   // containing a string with the name and a variant with the value, from
294   // |message_reader|. Returns false if message is in incorrect format.
295   bool UpdatePropertiesFromReader(MessageReader* reader);
296
297   // Updates a single property by reading a string with the name and a
298   // variant with the value from |message_reader|. Returns false if message
299   // is in incorrect format, or property type doesn't match.
300   bool UpdatePropertyFromReader(MessageReader* reader);
301
302   // Calls the property changed callback passed to the constructor, used
303   // by sub-classes that do not call UpdatePropertiesFromReader() or
304   // UpdatePropertyFromReader(). Takes the |name| of the changed property.
305   void NotifyPropertyChanged(const std::string& name);
306
307   // Retrieves the object proxy this property set was initialized with,
308   // provided for sub-classes overriding methods that make D-Bus calls
309   // and for Property<>. Not permitted with const references to this class.
310   ObjectProxy* object_proxy() { return object_proxy_; }
311
312   // Retrieves the interface of this property set.
313   const std::string& interface() const { return interface_; }
314
315  protected:
316   // Get a weak pointer to this property set, provided so that sub-classes
317   // overriding methods that make D-Bus calls may use the existing (or
318   // override) callbacks without providing their own weak pointer factory.
319   base::WeakPtr<PropertySet> GetWeakPtr() {
320     return weak_ptr_factory_.GetWeakPtr();
321   }
322
323  private:
324   // Invalidates properties by reading an array of names, from
325   // |message_reader|. Returns false if message is in incorrect format.
326   bool InvalidatePropertiesFromReader(MessageReader* reader);
327
328   // Pointer to object proxy for making method calls, no ownership is taken
329   // so this must outlive this class.
330   ObjectProxy* object_proxy_;
331
332   // Interface of property, e.g. "org.chromium.ExampleService", this is
333   // distinct from the interface of the method call itself which is the
334   // general D-Bus Properties interface "org.freedesktop.DBus.Properties".
335   std::string interface_;
336
337   // Callback for property changes.
338   PropertyChangedCallback property_changed_callback_;
339
340   // Map of properties (as PropertyBase*) defined in the structure to
341   // names as used in D-Bus method calls and signals. The base pointer
342   // restricts property access via this map to type-unsafe and non-specific
343   // actions only.
344   typedef std::map<const std::string, PropertyBase*> PropertiesMap;
345   PropertiesMap properties_map_;
346
347   // Weak pointer factory as D-Bus callbacks may last longer than these
348   // objects.
349   base::WeakPtrFactory<PropertySet> weak_ptr_factory_;
350
351   DISALLOW_COPY_AND_ASSIGN(PropertySet);
352 };
353
354 // Property template, this defines the type-specific and type-safe methods
355 // of properties that can be accessed as members of a PropertySet structure.
356 //
357 // Properties provide a cached value that has an initial sensible default
358 // until the reply to PropertySet::GetAll() is retrieved and is updated by
359 // all calls to that method, PropertySet::Get() and property changed signals
360 // also handled by PropertySet. It can be obtained by calling value() on the
361 // property.
362 //
363 // It is recommended that this cached value be used where necessary, with
364 // code using PropertySet::PropertyChangedCallback to be notified of changes,
365 // rather than incurring a round-trip to the remote object for each property
366 // access.
367 //
368 // Where a round-trip is necessary, the Get() method is provided. And to
369 // update the remote object value, the Set() method is also provided; these
370 // both simply call methods on PropertySet.
371 //
372 // Handling of particular D-Bus types is performed via specialization,
373 // typically the PopValueFromReader() and AppendSetValueToWriter() methods
374 // will need to be provided, and in rare cases a constructor to provide a
375 // default value. Specializations for basic D-Bus types, strings, object
376 // paths and arrays are provided for you.
377 template <class T>
378 class CHROME_DBUS_EXPORT Property : public PropertyBase {
379  public:
380   Property() {}
381   ~Property() override {}
382
383   // Retrieves the cached value.
384   const T& value() const { return value_; }
385
386   // Requests an updated value from the remote object incurring a
387   // round-trip. |callback| will be called when the new value is available.
388   // This may not be implemented by some interfaces.
389   virtual void Get(dbus::PropertySet::GetCallback callback) {
390     property_set()->Get(this, callback);
391   }
392
393   // The synchronous version of Get().
394   // This should never be used on an interactive thread.
395   virtual bool GetAndBlock() {
396     return property_set()->GetAndBlock(this);
397   }
398
399   // Requests that the remote object change the property value to |value|,
400   // |callback| will be called to indicate the success or failure of the
401   // request, however the new value may not be available depending on the
402   // remote object.
403   virtual void Set(const T& value, dbus::PropertySet::SetCallback callback) {
404     set_value_ = value;
405     property_set()->Set(this, callback);
406   }
407
408   // The synchronous version of Set().
409   // This should never be used on an interactive thread.
410   virtual bool SetAndBlock(const T& value) {
411     set_value_ = value;
412     return property_set()->SetAndBlock(this);
413   }
414
415   // Method used by PropertySet to retrieve the value from a MessageReader,
416   // no knowledge of the contained type is required, this method returns
417   // true if its expected type was found, false if not.
418   bool PopValueFromReader(MessageReader* reader) override;
419
420   // Method used by PropertySet to append the set value to a MessageWriter,
421   // no knowledge of the contained type is required.
422   // Implementation provided by specialization.
423   void AppendSetValueToWriter(MessageWriter* writer) override;
424
425   // Method used by test and stub implementations of dbus::PropertySet::Set
426   // to replace the property value with the set value without using a
427   // dbus::MessageReader.
428   void ReplaceValueWithSetValue() override {
429     value_ = set_value_;
430     property_set()->NotifyPropertyChanged(name());
431   }
432
433   // Method used by test and stub implementations to directly set the
434   // value of a property.
435   void ReplaceValue(const T& value) {
436     value_ = value;
437     property_set()->NotifyPropertyChanged(name());
438   }
439
440   // Method used by test and stub implementations to directly set the
441   // |set_value_| of a property.
442   void ReplaceSetValueForTesting(const T& value) { set_value_ = value; }
443
444   // Method used by test and stub implementations to retrieve the |set_value|
445   // of a property.
446   const T& GetSetValueForTesting() const { return set_value_; }
447
448  private:
449   // Current cached value of the property.
450   T value_;
451
452   // Replacement value of the property.
453   T set_value_;
454 };
455
456 // Clang and GCC don't agree on how attributes should work for explicitly
457 // instantiated templates. GCC ignores attributes on explicit instantiations
458 // (and emits a warning) while Clang requires the visiblity attribute on the
459 // explicit instantiations for them to be visible to other compilation units.
460 // Hopefully clang and GCC agree one day, and this can be cleaned up:
461 // https://llvm.org/bugs/show_bug.cgi?id=24815
462 #pragma GCC diagnostic push
463 #pragma GCC diagnostic ignored "-Wattributes"
464
465 template <>
466 CHROME_DBUS_EXPORT Property<uint8_t>::Property();
467 template <>
468 CHROME_DBUS_EXPORT bool Property<uint8_t>::PopValueFromReader(
469     MessageReader* reader);
470 template <>
471 CHROME_DBUS_EXPORT void Property<uint8_t>::AppendSetValueToWriter(
472     MessageWriter* writer);
473 extern template class CHROME_DBUS_EXPORT Property<uint8_t>;
474
475 template <>
476 CHROME_DBUS_EXPORT Property<bool>::Property();
477 template <>
478 CHROME_DBUS_EXPORT bool Property<bool>::PopValueFromReader(
479     MessageReader* reader);
480 template <>
481 CHROME_DBUS_EXPORT void Property<bool>::AppendSetValueToWriter(
482     MessageWriter* writer);
483 extern template class CHROME_DBUS_EXPORT Property<bool>;
484
485 template <>
486 CHROME_DBUS_EXPORT Property<int16_t>::Property();
487 template <>
488 CHROME_DBUS_EXPORT bool Property<int16_t>::PopValueFromReader(
489     MessageReader* reader);
490 template <>
491 CHROME_DBUS_EXPORT void Property<int16_t>::AppendSetValueToWriter(
492     MessageWriter* writer);
493 extern template class CHROME_DBUS_EXPORT Property<int16_t>;
494
495 template <>
496 CHROME_DBUS_EXPORT Property<uint16_t>::Property();
497 template <>
498 CHROME_DBUS_EXPORT bool Property<uint16_t>::PopValueFromReader(
499     MessageReader* reader);
500 template <>
501 CHROME_DBUS_EXPORT void Property<uint16_t>::AppendSetValueToWriter(
502     MessageWriter* writer);
503 extern template class CHROME_DBUS_EXPORT Property<uint16_t>;
504
505 template <>
506 CHROME_DBUS_EXPORT Property<int32_t>::Property();
507 template <>
508 CHROME_DBUS_EXPORT bool Property<int32_t>::PopValueFromReader(
509     MessageReader* reader);
510 template <>
511 CHROME_DBUS_EXPORT void Property<int32_t>::AppendSetValueToWriter(
512     MessageWriter* writer);
513 extern template class CHROME_DBUS_EXPORT Property<int32_t>;
514
515 template <>
516 CHROME_DBUS_EXPORT Property<uint32_t>::Property();
517 template <>
518 CHROME_DBUS_EXPORT bool Property<uint32_t>::PopValueFromReader(
519     MessageReader* reader);
520 template <>
521 CHROME_DBUS_EXPORT void Property<uint32_t>::AppendSetValueToWriter(
522     MessageWriter* writer);
523 extern template class CHROME_DBUS_EXPORT Property<uint32_t>;
524
525 template <>
526 CHROME_DBUS_EXPORT Property<int64_t>::Property();
527 template <>
528 CHROME_DBUS_EXPORT bool Property<int64_t>::PopValueFromReader(
529     MessageReader* reader);
530 template <>
531 CHROME_DBUS_EXPORT void Property<int64_t>::AppendSetValueToWriter(
532     MessageWriter* writer);
533 extern template class CHROME_DBUS_EXPORT Property<int64_t>;
534
535 template <>
536 CHROME_DBUS_EXPORT Property<uint64_t>::Property();
537 template <>
538 CHROME_DBUS_EXPORT bool Property<uint64_t>::PopValueFromReader(
539     MessageReader* reader);
540 template <>
541 CHROME_DBUS_EXPORT void Property<uint64_t>::AppendSetValueToWriter(
542     MessageWriter* writer);
543 extern template class CHROME_DBUS_EXPORT Property<uint64_t>;
544
545 template <>
546 CHROME_DBUS_EXPORT Property<double>::Property();
547 template <>
548 CHROME_DBUS_EXPORT bool Property<double>::PopValueFromReader(
549     MessageReader* reader);
550 template <>
551 CHROME_DBUS_EXPORT void Property<double>::AppendSetValueToWriter(
552     MessageWriter* writer);
553 extern template class CHROME_DBUS_EXPORT Property<double>;
554
555 template <>
556 CHROME_DBUS_EXPORT bool Property<std::string>::PopValueFromReader(
557     MessageReader* reader);
558 template <>
559 CHROME_DBUS_EXPORT void Property<std::string>::AppendSetValueToWriter(
560     MessageWriter* writer);
561 extern template class CHROME_DBUS_EXPORT Property<std::string>;
562
563 template <>
564 CHROME_DBUS_EXPORT bool Property<ObjectPath>::PopValueFromReader(
565     MessageReader* reader);
566 template <>
567 CHROME_DBUS_EXPORT void Property<ObjectPath>::AppendSetValueToWriter(
568     MessageWriter* writer);
569 extern template class CHROME_DBUS_EXPORT Property<ObjectPath>;
570
571 template <>
572 CHROME_DBUS_EXPORT bool Property<std::vector<std::string>>::PopValueFromReader(
573     MessageReader* reader);
574 template <>
575 CHROME_DBUS_EXPORT void Property<
576     std::vector<std::string>>::AppendSetValueToWriter(MessageWriter* writer);
577 extern template class CHROME_DBUS_EXPORT Property<std::vector<std::string>>;
578
579 template <>
580 CHROME_DBUS_EXPORT bool Property<std::vector<ObjectPath>>::PopValueFromReader(
581     MessageReader* reader);
582 template <>
583 CHROME_DBUS_EXPORT void Property<
584     std::vector<ObjectPath>>::AppendSetValueToWriter(MessageWriter* writer);
585 extern template class CHROME_DBUS_EXPORT Property<std::vector<ObjectPath>>;
586
587 template <>
588 CHROME_DBUS_EXPORT bool Property<std::vector<uint8_t>>::PopValueFromReader(
589     MessageReader* reader);
590 template <>
591 CHROME_DBUS_EXPORT void Property<std::vector<uint8_t>>::AppendSetValueToWriter(
592     MessageWriter* writer);
593 extern template class CHROME_DBUS_EXPORT Property<std::vector<uint8_t>>;
594
595 template <>
596 CHROME_DBUS_EXPORT bool
597 Property<std::map<std::string, std::string>>::PopValueFromReader(
598     MessageReader* reader);
599 template <>
600 CHROME_DBUS_EXPORT void
601 Property<std::map<std::string, std::string>>::AppendSetValueToWriter(
602     MessageWriter* writer);
603 extern template class CHROME_DBUS_EXPORT
604     Property<std::map<std::string, std::string>>;
605
606 template <>
607 CHROME_DBUS_EXPORT bool
608 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
609     PopValueFromReader(MessageReader* reader);
610 template <>
611 CHROME_DBUS_EXPORT void
612 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
613     AppendSetValueToWriter(MessageWriter* writer);
614 extern template class CHROME_DBUS_EXPORT
615     Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
616
617 template <>
618 CHROME_DBUS_EXPORT bool
619 Property<std::map<std::string, std::vector<uint8_t>>>::PopValueFromReader(
620     MessageReader* reader);
621 template <>
622 CHROME_DBUS_EXPORT void
623 Property<std::map<std::string, std::vector<uint8_t>>>::AppendSetValueToWriter(
624     MessageWriter* writer);
625 extern template class CHROME_DBUS_EXPORT
626     Property<std::map<std::string, std::vector<uint8_t>>>;
627
628 template <>
629 CHROME_DBUS_EXPORT bool
630 Property<std::map<uint16_t, std::vector<uint8_t>>>::PopValueFromReader(
631     MessageReader* reader);
632 template <>
633 CHROME_DBUS_EXPORT void
634 Property<std::map<uint16_t, std::vector<uint8_t>>>::AppendSetValueToWriter(
635     MessageWriter* writer);
636 extern template class CHROME_DBUS_EXPORT
637     Property<std::map<uint16_t, std::vector<uint8_t>>>;
638
639 #pragma GCC diagnostic pop
640
641 }  // namespace dbus
642
643 #endif  // DBUS_PROPERTY_H_