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 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" | |
6 | |
7 #include "chromeos/dbus/dbus_thread_manager.h" | |
8 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | |
9 | |
10 namespace chromeos { | |
11 | |
12 FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider( | |
13 const dbus::ObjectPath& object_path, | |
14 Delegate* delegate) | |
15 : object_path_(object_path), | |
16 delegate_(delegate) { | |
17 VLOG(1) << "Creating Bluetooth Profile: " << object_path_.value(); | |
18 | |
19 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = | |
20 static_cast<FakeBluetoothProfileManagerClient*>( | |
21 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); | |
22 fake_bluetooth_profile_manager_client->RegisterProfileServiceProvider(this); | |
23 } | |
24 | |
25 FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() { | |
26 VLOG(1) << "Cleaning up Bluetooth Profile: " << object_path_.value(); | |
27 | |
28 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = | |
29 static_cast<FakeBluetoothProfileManagerClient*>( | |
30 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); | |
31 fake_bluetooth_profile_manager_client->UnregisterProfileServiceProvider(this); | |
32 } | |
33 | |
34 void FakeBluetoothProfileServiceProvider::Released() { | |
35 VLOG(1) << object_path_.value() << ": Released"; | |
36 delegate_->Released(); | |
37 } | |
38 | |
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); | |
47 } | |
48 | |
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); | |
55 } | |
56 | |
57 void FakeBluetoothProfileServiceProvider::Cancel() { | |
58 VLOG(1) << object_path_.value() << ": Cancel"; | |
59 delegate_->Cancel(); | |
60 } | |
61 | |
62 } // namespace chromeos | |
OLD | NEW |