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_MANAGER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace chromeos { | 22 namespace chromeos { |
23 | 23 |
24 // ShillManagerClient is used to communicate with the Shill Manager | 24 // ShillManagerClient is used to communicate with the Shill Manager |
25 // service. All methods should be called from the origin thread which | 25 // service. All methods should be called from the origin thread which |
26 // initializes the DBusThreadManager instance. | 26 // initializes the DBusThreadManager instance. |
27 class CHROMEOS_EXPORT ShillManagerClient { | 27 class CHROMEOS_EXPORT ShillManagerClient { |
28 public: | 28 public: |
29 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 29 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
30 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | 30 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; |
31 typedef ShillClientHelper::ErrorCallback ErrorCallback; | |
32 typedef ShillClientHelper::PropertyChangedObserver PropertyChangedObserver; | |
31 | 33 |
32 virtual ~ShillManagerClient(); | 34 virtual ~ShillManagerClient(); |
33 | 35 |
34 // Factory function, creates a new instance which is owned by the caller. | 36 // Factory function, creates a new instance which is owned by the caller. |
35 // For normal usage, access the singleton via DBusThreadManager::Get(). | 37 // For normal usage, access the singleton via DBusThreadManager::Get(). |
36 static ShillManagerClient* Create(DBusClientImplementationType type, | 38 static ShillManagerClient* Create(DBusClientImplementationType type, |
37 dbus::Bus* bus); | 39 dbus::Bus* bus); |
38 | 40 |
39 // Sets PropertyChanged signal handler. | 41 virtual void AddPropertyChangedObserver( |
hashimoto
2012/09/21 11:52:01
Please add method comments.
Greg Spencer (Chromium)
2012/09/21 22:03:47
Done.
| |
40 virtual void SetPropertyChangedHandler( | 42 PropertyChangedObserver* observer) = 0; |
41 const PropertyChangedHandler& handler) = 0; | |
42 | 43 |
43 // Resets PropertyChanged signal handler. | 44 virtual void RemovePropertyChangedObserver( |
44 virtual void ResetPropertyChangedHandler() = 0; | 45 PropertyChangedObserver* observer) = 0; |
45 | 46 |
46 // Calls GetProperties method. | 47 // Calls GetProperties method. |
47 // |callback| is called after the method call succeeds. | 48 // |callback| is called after the method call succeeds. |
48 virtual void GetProperties(const DictionaryValueCallback& callback) = 0; | 49 virtual void GetProperties(const DictionaryValueCallback& callback) = 0; |
49 | 50 |
50 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the | 51 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the |
51 // method call finishes. The caller is responsible to delete the result. | 52 // method call finishes. The caller is responsible to delete the result. |
52 // Thie method returns NULL when method call fails. | 53 // Thie method returns NULL when method call fails. |
53 // | 54 // |
54 // TODO(hashimoto): Refactor CrosGetWifiAccessPoints and remove this method. | 55 // TODO(hashimoto): Refactor CrosGetWifiAccessPoints and remove this method. |
55 // crosbug.com/29902 | 56 // crosbug.com/29902 |
56 virtual base::DictionaryValue* CallGetPropertiesAndBlock() = 0; | 57 virtual base::DictionaryValue* CallGetPropertiesAndBlock() = 0; |
57 | 58 |
58 // Calls SetProperty method. | 59 // Calls SetProperty method. |
59 // |callback| is called after the method call succeeds. | 60 // |callback| is called after the method call succeeds. |
60 virtual void SetProperty(const std::string& name, | 61 virtual void SetProperty(const std::string& name, |
61 const base::Value& value, | 62 const base::Value& value, |
62 const VoidDBusMethodCallback& callback) = 0; | 63 const base::Closure& callback, |
64 const ErrorCallback& error_callback) = 0; | |
63 | 65 |
64 // Calls RequestScan method. | 66 // Calls RequestScan method. |
65 // |callback| is called after the method call succeeds. | 67 // |callback| is called after the method call succeeds. |
66 virtual void RequestScan(const std::string& type, | 68 virtual void RequestScan(const std::string& type, |
67 const VoidDBusMethodCallback& callback) = 0; | 69 const base::Closure& callback, |
70 const ErrorCallback& error_callback) = 0; | |
68 | 71 |
69 // Calls EnableTechnology method. | 72 // Calls EnableTechnology method. |
70 // |callback| is called after the method call succeeds. | 73 // |callback| is called after the method call succeeds. |
71 virtual void EnableTechnology(const std::string& type, | 74 virtual void EnableTechnology(const std::string& type, |
72 const VoidDBusMethodCallback& callback) = 0; | 75 const base::Closure& callback, |
76 const ErrorCallback& error_callback) = 0; | |
73 | 77 |
74 // Calls DisableTechnology method. | 78 // Calls DisableTechnology method. |
75 // |callback| is called after the method call succeeds. | 79 // |callback| is called after the method call succeeds. |
76 virtual void DisableTechnology(const std::string& type, | 80 virtual void DisableTechnology(const std::string& type, |
77 const VoidDBusMethodCallback& callback) = 0; | 81 const base::Closure& callback, |
82 const ErrorCallback& error_callback) = 0; | |
78 | 83 |
79 // Calls ConfigureService method. | 84 // Calls ConfigureService method. |
80 // |callback| is called after the method call succeeds. | 85 // |callback| is called after the method call succeeds. |
81 virtual void ConfigureService(const base::DictionaryValue& properties, | 86 virtual void ConfigureService(const base::DictionaryValue& properties, |
82 const VoidDBusMethodCallback& callback) = 0; | 87 const base::Closure& callback, |
88 const ErrorCallback& error_callback) = 0; | |
83 | 89 |
84 // Calls GetService method. | 90 // Calls GetService method. |
85 // |callback| is called after the method call succeeds. | 91 // |callback| is called after the method call succeeds. |
86 virtual void GetService(const base::DictionaryValue& properties, | 92 virtual void GetService(const base::DictionaryValue& properties, |
87 const ObjectPathDBusMethodCallback& callback) = 0; | 93 const ObjectPathDBusMethodCallback& callback, |
94 const ErrorCallback& error_callback) = 0; | |
88 | 95 |
89 protected: | 96 protected: |
90 // Create() should be used instead. | 97 // Create() should be used instead. |
91 ShillManagerClient(); | 98 ShillManagerClient(); |
92 | 99 |
93 private: | 100 private: |
94 DISALLOW_COPY_AND_ASSIGN(ShillManagerClient); | 101 DISALLOW_COPY_AND_ASSIGN(ShillManagerClient); |
95 }; | 102 }; |
96 | 103 |
97 } // namespace chromeos | 104 } // namespace chromeos |
98 | 105 |
99 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ | 106 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ |
OLD | NEW |