| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/dbus_client.h" |
| 13 #include "chromeos/dbus/shill_client_helper.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 class ShillThirdPartyVpnObserver; |
| 18 |
| 19 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill |
| 20 // ThirdPartyVpnDriver service. |
| 21 // All methods should be called from the origin thread which initializes the |
| 22 // DBusThreadManager instance. |
| 23 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { |
| 24 public: |
| 25 class TestInterface { |
| 26 public: |
| 27 virtual void OnPacketReceived(const std::string& object_path_value, |
| 28 const std::string& packet) = 0; |
| 29 virtual void OnPlatformMessage(const std::string& object_path_value, |
| 30 uint32_t message) = 0; |
| 31 |
| 32 protected: |
| 33 virtual ~TestInterface() {} |
| 34 }; |
| 35 |
| 36 ~ShillThirdPartyVpnDriverClient() override; |
| 37 |
| 38 // Factory function, creates a new instance which is owned by the caller. |
| 39 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 40 static ShillThirdPartyVpnDriverClient* Create(); |
| 41 |
| 42 // Adds an |observer| for the third party vpn driver at |object_path_value|. |
| 43 virtual void AddShillThirdPartyVpnObserver( |
| 44 const std::string& object_path_value, |
| 45 ShillThirdPartyVpnObserver* observer) = 0; |
| 46 |
| 47 // Removes an |observer| for the third party vpn driver at |
| 48 // |object_path_value|. |
| 49 virtual void RemoveShillThirdPartyVpnObserver( |
| 50 const std::string& object_path_value) = 0; |
| 51 |
| 52 // Calls SetParameters method. |
| 53 // |callback| is called after the method call succeeds. |
| 54 virtual void SetParameters( |
| 55 const std::string& object_path_value, |
| 56 const base::DictionaryValue& parameters, |
| 57 const base::Closure& callback, |
| 58 const ShillClientHelper::ErrorCallback& error_callback) = 0; |
| 59 |
| 60 // Calls UpdateConnectionState method. |
| 61 // |callback| is called after the method call succeeds. |
| 62 virtual void UpdateConnectionState( |
| 63 const std::string& object_path_value, |
| 64 const uint32_t connection_state, |
| 65 const base::Closure& callback, |
| 66 const ShillClientHelper::ErrorCallback& error_callback) = 0; |
| 67 |
| 68 // Calls SendPacket method. |
| 69 // |callback| is called after the method call succeeds. |
| 70 virtual void SendPacket( |
| 71 const std::string& object_path_value, |
| 72 const std::string& ip_packet, |
| 73 const base::Closure& callback, |
| 74 const ShillClientHelper::ErrorCallback& error_callback) = 0; |
| 75 |
| 76 // Returns an interface for testing (stub only), or returns nullptr. |
| 77 virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; |
| 78 |
| 79 protected: |
| 80 friend class ShillThirdPartyVpnDriverClientTest; |
| 81 |
| 82 // Create() should be used instead. |
| 83 ShillThirdPartyVpnDriverClient(); |
| 84 |
| 85 private: |
| 86 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); |
| 87 }; |
| 88 |
| 89 } // namespace chromeos |
| 90 |
| 91 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| OLD | NEW |