OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef DBUS_OBJECT_MANAGER_H_ | 5 #ifndef DBUS_OBJECT_MANAGER_H_ |
6 #define DBUS_OBJECT_MANAGER_H_ | 6 #define DBUS_OBJECT_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 class CHROME_DBUS_EXPORT ObjectManager | 138 class CHROME_DBUS_EXPORT ObjectManager |
139 : public base::RefCountedThreadSafe<ObjectManager> { | 139 : public base::RefCountedThreadSafe<ObjectManager> { |
140 public: | 140 public: |
141 // ObjectManager::Interface must be implemented by any class wishing to have | 141 // ObjectManager::Interface must be implemented by any class wishing to have |
142 // its remote objects managed by an ObjectManager. | 142 // its remote objects managed by an ObjectManager. |
143 class Interface { | 143 class Interface { |
144 public: | 144 public: |
145 virtual ~Interface() {} | 145 virtual ~Interface() {} |
146 | 146 |
147 // Called by ObjectManager to create a Properties structure for the remote | 147 // Called by ObjectManager to create a Properties structure for the remote |
148 // D-Bus object identified by |object_path| and accessibile through | 148 // D-Bus object identified by |object_path| and accessible through |
149 // |object_proxy|. The D-Bus interface name |interface_name| is that passed | 149 // |object_proxy|. The D-Bus interface name |interface_name| is that passed |
150 // to RegisterInterface() by the implementation class. | 150 // to RegisterInterface() by the implementation class. |
151 // | 151 // |
152 // The implementation class should create and return an instance of its own | 152 // The implementation class should create and return an instance of its own |
153 // subclass of dbus::PropertySet; ObjectManager will then connect signals | 153 // subclass of dbus::PropertySet; ObjectManager will then connect signals |
154 // and update the properties from its own internal message reader. | 154 // and update the properties from its own internal message reader. |
155 virtual PropertySet* CreateProperties( | 155 virtual PropertySet* CreateProperties( |
156 ObjectProxy *object_proxy, | 156 ObjectProxy *object_proxy, |
157 const dbus::ObjectPath& object_path, | 157 const dbus::ObjectPath& object_path, |
158 const std::string& interface_name) = 0; | 158 const std::string& interface_name) = 0; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // cast the returned pointer to the appropriate type, e.g.: | 219 // cast the returned pointer to the appropriate type, e.g.: |
220 // static_cast<Properties*>(GetProperties(object_path, my_interface)); | 220 // static_cast<Properties*>(GetProperties(object_path, my_interface)); |
221 PropertySet* GetProperties(const ObjectPath& object_path, | 221 PropertySet* GetProperties(const ObjectPath& object_path, |
222 const std::string& interface_name); | 222 const std::string& interface_name); |
223 | 223 |
224 // Instructs the object manager to refresh its list of managed objects; | 224 // Instructs the object manager to refresh its list of managed objects; |
225 // automatically called by the D-Bus thread manager, there should never be | 225 // automatically called by the D-Bus thread manager, there should never be |
226 // a need to call this manually. | 226 // a need to call this manually. |
227 void GetManagedObjects(); | 227 void GetManagedObjects(); |
228 | 228 |
| 229 // Returns true if the service providing this object is currently available |
| 230 // (i.e. its name has an owner). |
| 231 bool ServiceIsAvailable(); |
| 232 |
229 // Cleans up any match rules and filter functions added by this ObjectManager. | 233 // Cleans up any match rules and filter functions added by this ObjectManager. |
230 // The Bus object will take care of this so you don't have to do it manually. | 234 // The Bus object will take care of this so you don't have to do it manually. |
231 // | 235 // |
232 // BLOCKING CALL. | 236 // BLOCKING CALL. |
233 void CleanUp(); | 237 void CleanUp(); |
234 | 238 |
235 protected: | 239 protected: |
236 virtual ~ObjectManager(); | 240 virtual ~ObjectManager(); |
237 | 241 |
238 private: | 242 private: |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // Note: This should remain the last member so it'll be destroyed and | 359 // Note: This should remain the last member so it'll be destroyed and |
356 // invalidate its weak pointers before any other members are destroyed. | 360 // invalidate its weak pointers before any other members are destroyed. |
357 base::WeakPtrFactory<ObjectManager> weak_ptr_factory_; | 361 base::WeakPtrFactory<ObjectManager> weak_ptr_factory_; |
358 | 362 |
359 DISALLOW_COPY_AND_ASSIGN(ObjectManager); | 363 DISALLOW_COPY_AND_ASSIGN(ObjectManager); |
360 }; | 364 }; |
361 | 365 |
362 } // namespace dbus | 366 } // namespace dbus |
363 | 367 |
364 #endif // DBUS_OBJECT_MANAGER_H_ | 368 #endif // DBUS_OBJECT_MANAGER_H_ |
OLD | NEW |