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_PROFILE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // ShillProfileClient is used to communicate with the Shill Profile | 34 // ShillProfileClient is used to communicate with the Shill Profile |
35 // service. All methods should be called from the origin thread which | 35 // service. All methods should be called from the origin thread which |
36 // initializes the DBusThreadManager instance. | 36 // initializes the DBusThreadManager instance. |
37 class CHROMEOS_EXPORT ShillProfileClient { | 37 class CHROMEOS_EXPORT ShillProfileClient { |
38 public: | 38 public: |
39 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 39 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
40 typedef ShillClientHelper::DictionaryValueCallbackWithoutStatus | 40 typedef ShillClientHelper::DictionaryValueCallbackWithoutStatus |
41 DictionaryValueCallbackWithoutStatus; | 41 DictionaryValueCallbackWithoutStatus; |
42 typedef ShillClientHelper::ErrorCallback ErrorCallback; | 42 typedef ShillClientHelper::ErrorCallback ErrorCallback; |
43 | 43 |
| 44 // Interface for setting up services for testing. Accessed through |
| 45 // GetTestInterface(), only implemented in the stub implementation. |
| 46 class TestInterface { |
| 47 public: |
| 48 virtual void AddProfile(const std::string& profile_path) = 0; |
| 49 virtual void AddEntry(const std::string& profile_path, |
| 50 const std::string& entry_path, |
| 51 const base::DictionaryValue& properties) = 0; |
| 52 virtual bool AddService(const std::string& service_path) = 0; |
| 53 |
| 54 protected: |
| 55 virtual ~TestInterface() {} |
| 56 }; |
| 57 |
44 virtual ~ShillProfileClient(); | 58 virtual ~ShillProfileClient(); |
45 | 59 |
46 // Factory function, creates a new instance which is owned by the caller. | 60 // Factory function, creates a new instance which is owned by the caller. |
47 // For normal usage, access the singleton via DBusThreadManager::Get(). | 61 // For normal usage, access the singleton via DBusThreadManager::Get(). |
48 static ShillProfileClient* Create(DBusClientImplementationType type, | 62 static ShillProfileClient* Create(DBusClientImplementationType type, |
49 dbus::Bus* bus); | 63 dbus::Bus* bus); |
50 | 64 |
51 // Adds a property changed |observer| for the profile at |profile_path|. | 65 // Adds a property changed |observer| for the profile at |profile_path|. |
52 virtual void AddPropertyChangedObserver( | 66 virtual void AddPropertyChangedObserver( |
53 const dbus::ObjectPath& profile_path, | 67 const dbus::ObjectPath& profile_path, |
(...skipping 18 matching lines...) Expand all Loading... |
72 const DictionaryValueCallbackWithoutStatus& callback, | 86 const DictionaryValueCallbackWithoutStatus& callback, |
73 const ErrorCallback& error_callback) = 0; | 87 const ErrorCallback& error_callback) = 0; |
74 | 88 |
75 // Calls DeleteEntry method. | 89 // Calls DeleteEntry method. |
76 // |callback| is called after the method call succeeds. | 90 // |callback| is called after the method call succeeds. |
77 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, | 91 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, |
78 const std::string& entry_path, | 92 const std::string& entry_path, |
79 const base::Closure& callback, | 93 const base::Closure& callback, |
80 const ErrorCallback& error_callback) = 0; | 94 const ErrorCallback& error_callback) = 0; |
81 | 95 |
| 96 // Returns an interface for testing (stub only), or returns NULL. |
| 97 virtual TestInterface* GetTestInterface() = 0; |
| 98 |
82 protected: | 99 protected: |
83 // Create() should be used instead. | 100 // Create() should be used instead. |
84 ShillProfileClient(); | 101 ShillProfileClient(); |
85 | 102 |
86 private: | 103 private: |
87 DISALLOW_COPY_AND_ASSIGN(ShillProfileClient); | 104 DISALLOW_COPY_AND_ASSIGN(ShillProfileClient); |
88 }; | 105 }; |
89 | 106 |
90 } // namespace chromeos | 107 } // namespace chromeos |
91 | 108 |
92 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_H_ | 109 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_H_ |
OLD | NEW |