| 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_SERVICE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // ShillServiceClient is used to communicate with the Shill Service | 32 // ShillServiceClient is used to communicate with the Shill Service |
| 33 // service. | 33 // service. |
| 34 // All methods should be called from the origin thread which initializes the | 34 // All methods should be called from the origin thread which initializes the |
| 35 // DBusThreadManager instance. | 35 // DBusThreadManager instance. |
| 36 class CHROMEOS_EXPORT ShillServiceClient { | 36 class CHROMEOS_EXPORT ShillServiceClient { |
| 37 public: | 37 public: |
| 38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
| 39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | 39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; |
| 40 typedef ShillClientHelper::ErrorCallback ErrorCallback; | 40 typedef ShillClientHelper::ErrorCallback ErrorCallback; |
| 41 | 41 |
| 42 // Interface for setting up services for testing. |
| 43 // Accessed through GetTestInterface(), only implemented in the Stub Impl. |
| 44 class TestInterface { |
| 45 public: |
| 46 virtual void AddService(const std::string& service_path, |
| 47 const std::string& name, |
| 48 const std::string& type, |
| 49 const std::string& state) = 0; |
| 50 virtual void RemoveService(const std::string& service_path) = 0; |
| 51 virtual void SetServiceProperty(const std::string& service_path, |
| 52 const std::string& property, |
| 53 const base::Value& value) = 0; |
| 54 virtual void ClearServices() = 0; |
| 55 |
| 56 protected: |
| 57 ~TestInterface() {} |
| 58 }; |
| 42 virtual ~ShillServiceClient(); | 59 virtual ~ShillServiceClient(); |
| 43 | 60 |
| 44 // Factory function, creates a new instance which is owned by the caller. | 61 // Factory function, creates a new instance which is owned by the caller. |
| 45 // For normal usage, access the singleton via DBusThreadManager::Get(). | 62 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 46 static ShillServiceClient* Create(DBusClientImplementationType type, | 63 static ShillServiceClient* Create(DBusClientImplementationType type, |
| 47 dbus::Bus* bus); | 64 dbus::Bus* bus); |
| 48 | 65 |
| 49 // Adds a property changed |observer| to the service at |service_path|. | 66 // Adds a property changed |observer| to the service at |service_path|. |
| 50 virtual void AddPropertyChangedObserver( | 67 virtual void AddPropertyChangedObserver( |
| 51 const dbus::ObjectPath& service_path, | 68 const dbus::ObjectPath& service_path, |
| 52 ShillPropertyChangedObserver* observer) = 0; | 69 ShillPropertyChangedObserver* observer) = 0; |
| 53 | 70 |
| 54 // Removes a property changed |observer| to the service at |service_path|. | 71 // Removes a property changed |observer| to the service at |service_path|. |
| 55 virtual void RemovePropertyChangedObserver( | 72 virtual void RemovePropertyChangedObserver( |
| 56 const dbus::ObjectPath& service_path, | 73 const dbus::ObjectPath& service_path, |
| 57 ShillPropertyChangedObserver* observer) = 0; | 74 ShillPropertyChangedObserver* observer) = 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 121 |
| 105 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until | 122 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until |
| 106 // the method call finishes. | 123 // the method call finishes. |
| 107 // | 124 // |
| 108 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method. | 125 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method. |
| 109 // crosbug.com/29902 | 126 // crosbug.com/29902 |
| 110 virtual bool CallActivateCellularModemAndBlock( | 127 virtual bool CallActivateCellularModemAndBlock( |
| 111 const dbus::ObjectPath& service_path, | 128 const dbus::ObjectPath& service_path, |
| 112 const std::string& carrier) = 0; | 129 const std::string& carrier) = 0; |
| 113 | 130 |
| 131 // Returns an interface for testing (stub only), or returns NULL. |
| 132 virtual TestInterface* GetTestInterface() = 0; |
| 133 |
| 114 protected: | 134 protected: |
| 115 // Create() should be used instead. | 135 // Create() should be used instead. |
| 116 ShillServiceClient(); | 136 ShillServiceClient(); |
| 117 | 137 |
| 118 private: | 138 private: |
| 119 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient); | 139 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient); |
| 120 }; | 140 }; |
| 121 | 141 |
| 122 } // namespace chromeos | 142 } // namespace chromeos |
| 123 | 143 |
| 124 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ | 144 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
| OLD | NEW |