| 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_PROFILE_SERVICE_PROVIDER_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ | 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_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/memory/scoped_ptr.h" |
| 10 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 11 #include "chromeos/dbus/dbus_client_implementation_type.h" | 12 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 12 #include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" | 13 #include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" |
| 13 #include "dbus/file_descriptor.h" | 14 #include "dbus/file_descriptor.h" |
| 14 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 | 18 |
| 18 // FakeBluetoothProfileServiceProvider simulates the behavior of a local | 19 // FakeBluetoothProfileServiceProvider simulates the behavior of a local |
| 19 // Bluetooth agent object and is used both in test cases in place of a | 20 // Bluetooth agent object and is used both in test cases in place of a |
| 20 // mock and on the Linux desktop. | 21 // mock and on the Linux desktop. |
| 21 class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider | 22 class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider |
| 22 : public ExperimentalBluetoothProfileServiceProvider { | 23 : public ExperimentalBluetoothProfileServiceProvider { |
| 23 public: | 24 public: |
| 24 FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path, | 25 FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path, |
| 25 Delegate *delegate); | 26 Delegate *delegate); |
| 26 virtual ~FakeBluetoothProfileServiceProvider(); | 27 virtual ~FakeBluetoothProfileServiceProvider(); |
| 27 | 28 |
| 28 // Each of these calls the equivalent | 29 // Each of these calls the equivalent |
| 29 // BluetoothProfileServiceProvider::Delegate method on the object passed on | 30 // BluetoothProfileServiceProvider::Delegate method on the object passed on |
| 30 // construction. | 31 // construction. |
| 31 virtual void Release(); | 32 virtual void Release(); |
| 32 virtual void NewConnection( | 33 virtual void NewConnection( |
| 33 const dbus::ObjectPath& device_path, | 34 const dbus::ObjectPath& device_path, |
| 34 dbus::FileDescriptor* fd, | 35 scoped_ptr<dbus::FileDescriptor> fd, |
| 35 const Delegate::Options& options, | 36 const Delegate::Options& options, |
| 36 const Delegate::ConfirmationCallback& callback); | 37 const Delegate::ConfirmationCallback& callback); |
| 37 virtual void RequestDisconnection( | 38 virtual void RequestDisconnection( |
| 38 const dbus::ObjectPath& device_path, | 39 const dbus::ObjectPath& device_path, |
| 39 const Delegate::ConfirmationCallback& callback); | 40 const Delegate::ConfirmationCallback& callback); |
| 40 virtual void Cancel(); | 41 virtual void Cancel(); |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // D-Bus object path we are faking. | 44 // D-Bus object path we are faking. |
| 44 dbus::ObjectPath object_path_; | 45 dbus::ObjectPath object_path_; |
| 45 | 46 |
| 46 // All incoming method calls are passed on to the Delegate and a callback | 47 // All incoming method calls are passed on to the Delegate and a callback |
| 47 // passed to generate the reply. |delegate_| is generally the object that | 48 // passed to generate the reply. |delegate_| is generally the object that |
| 48 // owns this one, and must outlive it. | 49 // owns this one, and must outlive it. |
| 49 Delegate* delegate_; | 50 Delegate* delegate_; |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 } // namespace chromeos | 53 } // namespace chromeos |
| 53 | 54 |
| 54 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ | 55 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ |
| OLD | NEW |