| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
| 12 |
| 13 namespace base { |
| 14 |
| 15 class Value; |
| 16 class DictionaryValue; |
| 17 |
| 18 } // namespace base |
| 19 |
| 20 namespace dbus { |
| 21 |
| 22 class Bus; |
| 23 class ObjectPath; |
| 24 |
| 25 } // namespace dbus |
| 26 |
| 27 namespace chromeos { |
| 28 |
| 29 // FlimflamIPConfigClient is used to communicate with the Flimflam IPConfig |
| 30 // service. All methods should be called from the origin thread which |
| 31 // initializes the DBusThreadManager instance. |
| 32 class FlimflamIPConfigClient { |
| 33 public: |
| 34 // An enum to describe whether or not a DBus method call succeeded. |
| 35 enum CallStatus { |
| 36 FAILURE, |
| 37 SUCCESS, |
| 38 }; |
| 39 |
| 40 // A callback to handle PropertyChanged signals. |
| 41 typedef base::Callback<void(const std::string& name, |
| 42 const base::Value& value)> PropertyChangedHandler; |
| 43 |
| 44 // A callback to handle responses of methods without results. |
| 45 typedef base::Callback<void(CallStatus call_status)> VoidCallback; |
| 46 |
| 47 // A callback to handle responses of methods with DictionaryValue results. |
| 48 typedef base::Callback<void( |
| 49 CallStatus call_status, |
| 50 const base::DictionaryValue& result)> DictionaryValueCallback; |
| 51 |
| 52 virtual ~FlimflamIPConfigClient(); |
| 53 |
| 54 // Factory function, creates a new instance which is owned by the caller. |
| 55 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 56 static FlimflamIPConfigClient* Create(dbus::Bus* bus); |
| 57 |
| 58 // Sets PropertyChanged signal handler. |
| 59 virtual void SetPropertyChangedHandler( |
| 60 const PropertyChangedHandler& handler) = 0; |
| 61 |
| 62 // Resets PropertyChanged signal handler. |
| 63 virtual void ResetPropertyChangedHandler() = 0; |
| 64 |
| 65 // Calls GetProperties method. |
| 66 // |callback| is called after the method call succeeds. |
| 67 virtual void GetProperties(const DictionaryValueCallback& callback) = 0; |
| 68 |
| 69 // Calls SetProperty method. |
| 70 // |callback| is called after the method call succeeds. |
| 71 virtual void SetProperty(const std::string& name, |
| 72 const base::Value& value, |
| 73 const VoidCallback& callback) = 0; |
| 74 |
| 75 // Calls ClearProperty method. |
| 76 // |callback| is called after the method call succeeds. |
| 77 virtual void ClearProperty(const std::string& name, |
| 78 const VoidCallback& callback) = 0; |
| 79 |
| 80 // Calls Remove method. |
| 81 // |callback| is called after the method call succeeds. |
| 82 virtual void Remove(const VoidCallback& callback) = 0; |
| 83 |
| 84 protected: |
| 85 // Create() should be used instead. |
| 86 FlimflamIPConfigClient(); |
| 87 |
| 88 private: |
| 89 DISALLOW_COPY_AND_ASSIGN(FlimflamIPConfigClient); |
| 90 }; |
| 91 |
| 92 } // namespace chromeos |
| 93 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ |
| OLD | NEW |