Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_agent_service_provider.cc
blobcd3207aed3bfd91b6d12f6653b4f67e71733cda1
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"
9 #include "dbus/object_path.h"
11 namespace chromeos {
13 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider(
14 const dbus::ObjectPath& object_path,
15 Delegate* delegate)
16 : object_path_(object_path),
17 delegate_(delegate) {
18 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value();
20 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
21 static_cast<FakeBluetoothAgentManagerClient*>(
22 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
23 fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this);
26 FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() {
27 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value();
29 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
30 static_cast<FakeBluetoothAgentManagerClient*>(
31 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
32 fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this);
35 void FakeBluetoothAgentServiceProvider::Release() {
36 VLOG(1) << object_path_.value() << ": Release";
37 delegate_->Released();
40 void FakeBluetoothAgentServiceProvider::RequestPinCode(
41 const dbus::ObjectPath& device_path,
42 const Delegate::PinCodeCallback& callback) {
43 VLOG(1) << object_path_.value() << ": RequestPinCode for "
44 << device_path.value();
45 delegate_->RequestPinCode(device_path, callback);
48 void FakeBluetoothAgentServiceProvider::DisplayPinCode(
49 const dbus::ObjectPath& device_path,
50 const std::string& pincode) {
51 VLOG(1) << object_path_.value() << ": DisplayPincode " << pincode << " for "
52 << device_path.value();
53 delegate_->DisplayPinCode(device_path, pincode);
56 void FakeBluetoothAgentServiceProvider::RequestPasskey(
57 const dbus::ObjectPath& device_path,
58 const Delegate::PasskeyCallback& callback) {
59 VLOG(1) << object_path_.value() << ": RequestPasskey for "
60 << device_path.value();
61 delegate_->RequestPasskey(device_path, callback);
64 void FakeBluetoothAgentServiceProvider::DisplayPasskey(
65 const dbus::ObjectPath& device_path,
66 uint32 passkey, int16 entered) {
67 VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey
68 << " (" << entered << " entered) for "<< device_path.value();
69 delegate_->DisplayPasskey(device_path, passkey, entered);
72 void FakeBluetoothAgentServiceProvider::RequestConfirmation(
73 const dbus::ObjectPath& device_path,
74 uint32 passkey,
75 const Delegate::ConfirmationCallback& callback) {
76 VLOG(1) << object_path_.value() << ": RequestConfirmation " << passkey
77 << " for "<< device_path.value();
78 delegate_->RequestConfirmation(device_path, passkey, callback);
81 void FakeBluetoothAgentServiceProvider::RequestAuthorization(
82 const dbus::ObjectPath& device_path,
83 const Delegate::ConfirmationCallback& callback) {
84 VLOG(1) << object_path_.value() << ": RequestAuthorization for "
85 << device_path.value();
86 delegate_->RequestAuthorization(device_path, callback);
89 void FakeBluetoothAgentServiceProvider::AuthorizeService(
90 const dbus::ObjectPath& device_path,
91 const std::string& uuid,
92 const Delegate::ConfirmationCallback& callback) {
93 VLOG(1) << object_path_.value() << ": AuthorizeService " << uuid << " for "
94 << device_path.value();
95 delegate_->AuthorizeService(device_path, uuid, callback);
98 void FakeBluetoothAgentServiceProvider::Cancel() {
99 VLOG(1) << object_path_.value() << ": Cancel";
100 delegate_->Cancel();
103 } // namespace chromeos