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.
5 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
12 FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider(
13 const dbus::ObjectPath
& object_path
,
15 : object_path_(object_path
),
17 VLOG(1) << "Creating Bluetooth Profile: " << object_path_
.value();
19 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client
=
20 static_cast<FakeBluetoothProfileManagerClient
*>(
21 DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
22 fake_bluetooth_profile_manager_client
->RegisterProfileServiceProvider(this);
25 FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() {
26 VLOG(1) << "Cleaning up Bluetooth Profile: " << object_path_
.value();
28 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client
=
29 static_cast<FakeBluetoothProfileManagerClient
*>(
30 DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
31 fake_bluetooth_profile_manager_client
->UnregisterProfileServiceProvider(this);
34 void FakeBluetoothProfileServiceProvider::Released() {
35 VLOG(1) << object_path_
.value() << ": Released";
36 delegate_
->Released();
39 void FakeBluetoothProfileServiceProvider::NewConnection(
40 const dbus::ObjectPath
& device_path
,
41 scoped_ptr
<dbus::FileDescriptor
> fd
,
42 const Delegate::Options
& options
,
43 const Delegate::ConfirmationCallback
& callback
) {
44 VLOG(1) << object_path_
.value() << ": NewConnection for "
45 << device_path
.value();
46 delegate_
->NewConnection(device_path
, fd
.Pass(), options
, callback
);
49 void FakeBluetoothProfileServiceProvider::RequestDisconnection(
50 const dbus::ObjectPath
& device_path
,
51 const Delegate::ConfirmationCallback
& callback
) {
52 VLOG(1) << object_path_
.value() << ": RequestDisconnection for "
53 << device_path
.value();
54 delegate_
->RequestDisconnection(device_path
, callback
);
57 void FakeBluetoothProfileServiceProvider::Cancel() {
58 VLOG(1) << object_path_
.value() << ": Cancel";
62 } // namespace chromeos