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_IPCONFIG_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_IPCONFIG_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_IPCONFIG_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_IPCONFIG_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class ShillPropertyChangedObserver; | 31 class ShillPropertyChangedObserver; |
32 | 32 |
33 // ShillIPConfigClient is used to communicate with the Shill IPConfig | 33 // ShillIPConfigClient is used to communicate with the Shill IPConfig |
34 // service. All methods should be called from the origin thread which | 34 // service. All methods should be called from the origin thread which |
35 // initializes the DBusThreadManager instance. | 35 // initializes the DBusThreadManager instance. |
36 class CHROMEOS_EXPORT ShillIPConfigClient : public DBusClient { | 36 class CHROMEOS_EXPORT ShillIPConfigClient : public DBusClient { |
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 |
| 41 class TestInterface { |
| 42 public: |
| 43 // Adds an IPConfig entry. |
| 44 virtual void AddIPConfig(const std::string& ip_config_path, |
| 45 const base::DictionaryValue& properties) = 0; |
| 46 |
| 47 protected: |
| 48 virtual ~TestInterface() {} |
| 49 }; |
| 50 |
40 virtual ~ShillIPConfigClient(); | 51 virtual ~ShillIPConfigClient(); |
41 | 52 |
42 // Factory function, creates a new instance which is owned by the caller. | 53 // Factory function, creates a new instance which is owned by the caller. |
43 // For normal usage, access the singleton via DBusThreadManager::Get(). | 54 // For normal usage, access the singleton via DBusThreadManager::Get(). |
44 static ShillIPConfigClient* Create(); | 55 static ShillIPConfigClient* Create(); |
45 | 56 |
46 // Adds a property changed |observer| for the ipconfig at |ipconfig_path|. | 57 // Adds a property changed |observer| for the ipconfig at |ipconfig_path|. |
47 virtual void AddPropertyChangedObserver( | 58 virtual void AddPropertyChangedObserver( |
48 const dbus::ObjectPath& ipconfig_path, | 59 const dbus::ObjectPath& ipconfig_path, |
49 ShillPropertyChangedObserver* observer) = 0; | 60 ShillPropertyChangedObserver* observer) = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
74 // |callback| is called after the method call succeeds. | 85 // |callback| is called after the method call succeeds. |
75 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, | 86 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, |
76 const std::string& name, | 87 const std::string& name, |
77 const VoidDBusMethodCallback& callback) = 0; | 88 const VoidDBusMethodCallback& callback) = 0; |
78 | 89 |
79 // Calls Remove method. | 90 // Calls Remove method. |
80 // |callback| is called after the method call succeeds. | 91 // |callback| is called after the method call succeeds. |
81 virtual void Remove(const dbus::ObjectPath& ipconfig_path, | 92 virtual void Remove(const dbus::ObjectPath& ipconfig_path, |
82 const VoidDBusMethodCallback& callback) = 0; | 93 const VoidDBusMethodCallback& callback) = 0; |
83 | 94 |
| 95 // Returns an interface for testing (stub only), or returns NULL. |
| 96 virtual ShillIPConfigClient::TestInterface* GetTestInterface() = 0; |
| 97 |
84 protected: | 98 protected: |
85 friend class ShillIPConfigClientTest; | 99 friend class ShillIPConfigClientTest; |
86 | 100 |
87 // Create() should be used instead. | 101 // Create() should be used instead. |
88 ShillIPConfigClient(); | 102 ShillIPConfigClient(); |
89 | 103 |
90 private: | 104 private: |
91 DISALLOW_COPY_AND_ASSIGN(ShillIPConfigClient); | 105 DISALLOW_COPY_AND_ASSIGN(ShillIPConfigClient); |
92 }; | 106 }; |
93 | 107 |
94 } // namespace chromeos | 108 } // namespace chromeos |
95 | 109 |
96 #endif // CHROMEOS_DBUS_SHILL_IPCONFIG_CLIENT_H_ | 110 #endif // CHROMEOS_DBUS_SHILL_IPCONFIG_CLIENT_H_ |
OLD | NEW |