Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_agent_service_provider.cc
blobcaf298893247b2d25af1a55f07d957ec4ed3a5f0
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_agent_service_provider.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
10 namespace chromeos {
12 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider(
13 const dbus::ObjectPath& object_path,
14 Delegate* delegate)
15 : object_path_(object_path),
16 delegate_(delegate) {
17 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value();
19 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
20 static_cast<FakeBluetoothAgentManagerClient*>(
21 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
22 fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this);
25 FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() {
26 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value();
28 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
29 static_cast<FakeBluetoothAgentManagerClient*>(
30 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
31 fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this);
34 void FakeBluetoothAgentServiceProvider::Release() {
35 VLOG(1) << object_path_.value() << ": Release";
36 delegate_->Released();
39 void FakeBluetoothAgentServiceProvider::RequestPinCode(
40 const dbus::ObjectPath& device_path,
41 const Delegate::PinCodeCallback& callback) {
42 VLOG(1) << object_path_.value() << ": RequestPinCode for "
43 << device_path.value();
44 delegate_->RequestPinCode(device_path, callback);
47 void FakeBluetoothAgentServiceProvider::DisplayPinCode(
48 const dbus::ObjectPath& device_path,
49 const std::string& pincode) {
50 VLOG(1) << object_path_.value() << ": DisplayPincode " << pincode << " for "
51 << device_path.value();
52 delegate_->DisplayPinCode(device_path, pincode);
55 void FakeBluetoothAgentServiceProvider::RequestPasskey(
56 const dbus::ObjectPath& device_path,
57 const Delegate::PasskeyCallback& callback) {
58 VLOG(1) << object_path_.value() << ": RequestPasskey for "
59 << device_path.value();
60 delegate_->RequestPasskey(device_path, callback);
63 void FakeBluetoothAgentServiceProvider::DisplayPasskey(
64 const dbus::ObjectPath& device_path,
65 uint32 passkey, int16 entered) {
66 VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey
67 << " (" << entered << " entered) for "<< device_path.value();
68 delegate_->DisplayPasskey(device_path, passkey, entered);
71 void FakeBluetoothAgentServiceProvider::RequestConfirmation(
72 const dbus::ObjectPath& device_path,
73 uint32 passkey,
74 const Delegate::ConfirmationCallback& callback) {
75 VLOG(1) << object_path_.value() << ": RequestConfirmation " << passkey
76 << " for "<< device_path.value();
77 delegate_->RequestConfirmation(device_path, passkey, callback);
80 void FakeBluetoothAgentServiceProvider::RequestAuthorization(
81 const dbus::ObjectPath& device_path,
82 const Delegate::ConfirmationCallback& callback) {
83 VLOG(1) << object_path_.value() << ": RequestAuthorization for "
84 << device_path.value();
85 delegate_->RequestAuthorization(device_path, callback);
88 void FakeBluetoothAgentServiceProvider::AuthorizeService(
89 const dbus::ObjectPath& device_path,
90 const std::string& uuid,
91 const Delegate::ConfirmationCallback& callback) {
92 VLOG(1) << object_path_.value() << ": AuthorizeService " << uuid << " for "
93 << device_path.value();
94 delegate_->AuthorizeService(device_path, uuid, callback);
97 void FakeBluetoothAgentServiceProvider::Cancel() {
98 VLOG(1) << object_path_.value() << ": Cancel";
99 delegate_->Cancel();
102 } // namespace chromeos