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