| 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_SHILL_NETWORK_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_SHILL_NETWORK_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/shill_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 class ShillPropertyChangedObserver; | |
| 33 | |
| 34 // ShillNetworkClient is used to communicate with the Shill Network | |
| 35 // service. All methods should be called from the origin thread which | |
| 36 // initializes the DBusThreadManager instance. | |
| 37 class CHROMEOS_EXPORT ShillNetworkClient { | |
| 38 public: | |
| 39 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | |
| 40 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | |
| 41 | |
| 42 virtual ~ShillNetworkClient(); | |
| 43 | |
| 44 // Factory function, creates a new instance which is owned by the caller. | |
| 45 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 46 static ShillNetworkClient* Create(DBusClientImplementationType type, | |
| 47 dbus::Bus* bus); | |
| 48 | |
| 49 // Adds a property changed |observer| for the network at |network_path|. | |
| 50 virtual void AddPropertyChangedObserver( | |
| 51 const dbus::ObjectPath& network_path, | |
| 52 ShillPropertyChangedObserver* observer) = 0; | |
| 53 | |
| 54 // Removes a property changed |observer| for the network at |network_path|. | |
| 55 virtual void RemovePropertyChangedObserver( | |
| 56 const dbus::ObjectPath& network_path, | |
| 57 ShillPropertyChangedObserver* observer) = 0; | |
| 58 | |
| 59 // Calls GetProperties method. | |
| 60 // |callback| is called after the method call succeeds. | |
| 61 virtual void GetProperties(const dbus::ObjectPath& network_path, | |
| 62 const DictionaryValueCallback& callback) = 0; | |
| 63 | |
| 64 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the | |
| 65 // method call finishes. The caller is responsible to delete the result. | |
| 66 // Thie method returns NULL when method call fails. | |
| 67 // | |
| 68 // TODO(hashimoto): Refactor CrosGetWifiAccessPoints and remove this method. | |
| 69 // crosbug.com/29902 | |
| 70 virtual base::DictionaryValue* CallGetPropertiesAndBlock( | |
| 71 const dbus::ObjectPath& network_path) = 0; | |
| 72 | |
| 73 protected: | |
| 74 // Create() should be used instead. | |
| 75 ShillNetworkClient(); | |
| 76 | |
| 77 private: | |
| 78 DISALLOW_COPY_AND_ASSIGN(ShillNetworkClient); | |
| 79 }; | |
| 80 | |
| 81 } // namespace chromeos | |
| 82 | |
| 83 #endif // CHROMEOS_DBUS_SHILL_NETWORK_CLIENT_H_ | |
| OLD | NEW |