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 DBUS_PROPERTY_H_ | 5 #ifndef DBUS_PROPERTY_H_ |
6 #define DBUS_PROPERTY_H_ | 6 #define DBUS_PROPERTY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // remote object that these properties are for, care should be taken to | 190 // remote object that these properties are for, care should be taken to |
191 // ensure that this object does not outlive the lifetime of the proxy; | 191 // ensure that this object does not outlive the lifetime of the proxy; |
192 // |interface| specifies the D-Bus interface of these properties, and | 192 // |interface| specifies the D-Bus interface of these properties, and |
193 // |property_changed_callback| specifies the callback for when properties | 193 // |property_changed_callback| specifies the callback for when properties |
194 // are changed, this may be a NULL callback. | 194 // are changed, this may be a NULL callback. |
195 PropertySet(ObjectProxy* object_proxy, const std::string& interface, | 195 PropertySet(ObjectProxy* object_proxy, const std::string& interface, |
196 PropertyChangedCallback property_changed_callback); | 196 PropertyChangedCallback property_changed_callback); |
197 | 197 |
198 // Destructor; we don't hold on to any references or memory that needs | 198 // Destructor; we don't hold on to any references or memory that needs |
199 // explicit clean-up, but clang thinks we might. | 199 // explicit clean-up, but clang thinks we might. |
200 ~PropertySet(); | 200 virtual ~PropertySet(); |
201 | 201 |
202 // Registers a property, generally called from the subclass constructor; | 202 // Registers a property, generally called from the subclass constructor; |
203 // pass the |name| of the property as used in method calls and signals, | 203 // pass the |name| of the property as used in method calls and signals, |
204 // and the pointer to the |property| member of the structure. This will | 204 // and the pointer to the |property| member of the structure. This will |
205 // call the PropertyBase::Init method. | 205 // call the PropertyBase::Init method. |
206 void RegisterProperty(const std::string& name, PropertyBase* property); | 206 void RegisterProperty(const std::string& name, PropertyBase* property); |
207 | 207 |
208 // Call after construction to connect property change notification | 208 // Call after construction to connect property change notification |
209 // signals. Sub-classes may override to use different D-Bus signals. | 209 // signals. Sub-classes may override to use different D-Bus signals. |
210 void ConnectSignals(); | 210 void ConnectSignals(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 T value_; | 412 T value_; |
413 | 413 |
414 // Weak pointer factory as D-Bus callbacks may last longer than these | 414 // Weak pointer factory as D-Bus callbacks may last longer than these |
415 // objects. | 415 // objects. |
416 base::WeakPtrFactory<Property<T> > weak_ptr_factory_; | 416 base::WeakPtrFactory<Property<T> > weak_ptr_factory_; |
417 }; | 417 }; |
418 | 418 |
419 } // namespace dbus | 419 } // namespace dbus |
420 | 420 |
421 #endif // DBUS_PROPERTY_H_ | 421 #endif // DBUS_PROPERTY_H_ |
OLD | NEW |