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