| 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 CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 14 #include "chromeos/dbus/flimflam_client_helper.h" | |
| 15 | |
| 16 namespace base { | |
| 17 | |
| 18 class Value; | |
| 19 class DictionaryValue; | |
| 20 | |
| 21 } // namespace base | |
| 22 | |
| 23 namespace dbus { | |
| 24 | |
| 25 class Bus; | |
| 26 class ObjectPath; | |
| 27 | |
| 28 } // namespace dbus | |
| 29 | |
| 30 namespace chromeos { | |
| 31 | |
| 32 // FlimflamIPConfigClient is used to communicate with the Flimflam IPConfig | |
| 33 // service. All methods should be called from the origin thread which | |
| 34 // initializes the DBusThreadManager instance. | |
| 35 class CHROMEOS_EXPORT FlimflamIPConfigClient { | |
| 36 public: | |
| 37 typedef FlimflamClientHelper::PropertyChangedHandler PropertyChangedHandler; | |
| 38 typedef FlimflamClientHelper::DictionaryValueCallback DictionaryValueCallback; | |
| 39 virtual ~FlimflamIPConfigClient(); | |
| 40 | |
| 41 // Factory function, creates a new instance which is owned by the caller. | |
| 42 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 43 static FlimflamIPConfigClient* Create(DBusClientImplementationType type, | |
| 44 dbus::Bus* bus); | |
| 45 | |
| 46 // Sets PropertyChanged signal handler. | |
| 47 virtual void SetPropertyChangedHandler( | |
| 48 const dbus::ObjectPath& ipconfig_path, | |
| 49 const PropertyChangedHandler& handler) = 0; | |
| 50 | |
| 51 // Resets PropertyChanged signal handler. | |
| 52 virtual void ResetPropertyChangedHandler( | |
| 53 const dbus::ObjectPath& ipconfig_path) = 0; | |
| 54 | |
| 55 // Refreshes the active IP configuration after service property changes and | |
| 56 // renews the DHCP lease, if any. | |
| 57 virtual void Refresh(const dbus::ObjectPath& ipconfig_path, | |
| 58 const VoidDBusMethodCallback& callback) = 0; | |
| 59 | |
| 60 // Calls GetProperties method. | |
| 61 // |callback| is called after the method call succeeds. | |
| 62 virtual void GetProperties(const dbus::ObjectPath& ipconfig_path, | |
| 63 const DictionaryValueCallback& callback) = 0; | |
| 64 | |
| 65 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the | |
| 66 // method call finishes. The caller is responsible to delete the result. | |
| 67 // Thie method returns NULL when method call fails. | |
| 68 // | |
| 69 // TODO(hashimoto): Refactor CrosListIPConfigs to remove this method. | |
| 70 // crosbug.com/29902 | |
| 71 virtual base::DictionaryValue* CallGetPropertiesAndBlock( | |
| 72 const dbus::ObjectPath& ipconfig_path) = 0; | |
| 73 | |
| 74 // Calls SetProperty method. | |
| 75 // |callback| is called after the method call succeeds. | |
| 76 virtual void SetProperty(const dbus::ObjectPath& ipconfig_path, | |
| 77 const std::string& name, | |
| 78 const base::Value& value, | |
| 79 const VoidDBusMethodCallback& callback) = 0; | |
| 80 | |
| 81 // Calls ClearProperty method. | |
| 82 // |callback| is called after the method call succeeds. | |
| 83 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, | |
| 84 const std::string& name, | |
| 85 const VoidDBusMethodCallback& callback) = 0; | |
| 86 | |
| 87 // Calls Remove method. | |
| 88 // |callback| is called after the method call succeeds. | |
| 89 virtual void Remove(const dbus::ObjectPath& ipconfig_path, | |
| 90 const VoidDBusMethodCallback& callback) = 0; | |
| 91 | |
| 92 // DEPRECATED DO NOT USE: Calls Remove method and blocks until the method call | |
| 93 // finishes. | |
| 94 // | |
| 95 // TODO(hashimoto): Refactor CrosRemoveIPConfig to remove this method. | |
| 96 // crosbug.com/29902 | |
| 97 virtual bool CallRemoveAndBlock(const dbus::ObjectPath& ipconfig_path) = 0; | |
| 98 | |
| 99 protected: | |
| 100 // Create() should be used instead. | |
| 101 FlimflamIPConfigClient(); | |
| 102 | |
| 103 private: | |
| 104 DISALLOW_COPY_AND_ASSIGN(FlimflamIPConfigClient); | |
| 105 }; | |
| 106 | |
| 107 } // namespace chromeos | |
| 108 | |
| 109 #endif // CHROMEOS_DBUS_FLIMFLAM_IPCONFIG_CLIENT_H_ | |
| OLD | NEW |