OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/observer_list.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 13 #include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" |
| 14 #include "dbus/object_path.h" |
| 15 #include "dbus/property.h" |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 // FakeBluetoothAgentServiceProvider simulates the behavior of a local |
| 20 // Bluetooth agent object and is used both in test cases in place of a |
| 21 // mock and on the Linux desktop. |
| 22 class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider |
| 23 : public ExperimentalBluetoothAgentServiceProvider { |
| 24 public: |
| 25 FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path, |
| 26 Delegate *delegate); |
| 27 virtual ~FakeBluetoothAgentServiceProvider(); |
| 28 |
| 29 // Each of these calls the equivalent BluetoothAgentServiceProvider::Delegate |
| 30 // method on the object passed on construction. |
| 31 virtual void Release(); |
| 32 virtual void RequestPinCode(const dbus::ObjectPath& device_path, |
| 33 const Delegate::PinCodeCallback& callback); |
| 34 virtual void DisplayPinCode(const dbus::ObjectPath& device_path, |
| 35 const std::string& pincode); |
| 36 virtual void RequestPasskey(const dbus::ObjectPath& device_path, |
| 37 const Delegate::PasskeyCallback& callback); |
| 38 virtual void DisplayPasskey(const dbus::ObjectPath& device_path, |
| 39 uint32 passkey, int16 entered); |
| 40 virtual void RequestConfirmation( |
| 41 const dbus::ObjectPath& device_path, |
| 42 uint32 passkey, |
| 43 const Delegate::ConfirmationCallback& callback); |
| 44 virtual void RequestAuthorization( |
| 45 const dbus::ObjectPath& device_path, |
| 46 const Delegate::ConfirmationCallback& callback); |
| 47 virtual void AuthorizeService( |
| 48 const dbus::ObjectPath& device_path, |
| 49 const std::string& uuid, |
| 50 const Delegate::ConfirmationCallback& callback); |
| 51 virtual void Cancel(); |
| 52 |
| 53 private: |
| 54 // D-Bus object path we are faking. |
| 55 dbus::ObjectPath object_path_; |
| 56 |
| 57 // All incoming method calls are passed on to the Delegate and a callback |
| 58 // passed to generate the reply. |delegate_| is generally the object that |
| 59 // owns this one, and must outlive it. |
| 60 Delegate* delegate_; |
| 61 }; |
| 62 |
| 63 } // namespace chromeos |
| 64 |
| 65 #endif /* CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ */ |
OLD | NEW |