| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h" | 5 #include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h" |
| 6 | 6 |
| 7 #include "chromeos/dbus/dbus_thread_manager.h" |
| 8 #include "chromeos/dbus/fake_bluetooth_media_client.h" |
| 9 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h" |
| 10 |
| 11 using dbus::ObjectPath; |
| 12 |
| 7 namespace chromeos { | 13 namespace chromeos { |
| 8 | 14 |
| 9 // TODO(mcchou): Add the logic of the behavior. | |
| 10 FakeBluetoothMediaEndpointServiceProvider:: | 15 FakeBluetoothMediaEndpointServiceProvider:: |
| 11 FakeBluetoothMediaEndpointServiceProvider( | 16 FakeBluetoothMediaEndpointServiceProvider(const ObjectPath object_path, |
| 12 const dbus::ObjectPath object_path, Delegate* delegate) | 17 Delegate* delegate) |
| 13 : object_path_(object_path) , delegate_(delegate) { | 18 : visible_(false), object_path_(object_path), delegate_(delegate) { |
| 14 VLOG(1) << "Create Bluetooth Media Endpoint: " << object_path_.value(); | 19 VLOG(1) << "Create Bluetooth Media Endpoint: " << object_path_.value(); |
| 15 // TODO(mcchou): Use the FakeBluetoothMediaClient in DBusThreadManager | |
| 16 // to register the FakeBluetoothMediaEndpoint object. | |
| 17 } | 20 } |
| 18 | 21 |
| 19 FakeBluetoothMediaEndpointServiceProvider:: | 22 FakeBluetoothMediaEndpointServiceProvider:: |
| 20 ~FakeBluetoothMediaEndpointServiceProvider() { | 23 ~FakeBluetoothMediaEndpointServiceProvider() { |
| 21 VLOG(1) << "Cleaning up Bluetooth Media Endpoint: " << object_path_.value(); | 24 VLOG(1) << "Cleaning up Bluetooth Media Endpoint: " << object_path_.value(); |
| 22 // TODO(mcchou): Use the FakeBluetoothMediaClient in DBusThreadManager | |
| 23 // to unregister the FakeBluetoothMediaEndpoint object. | |
| 24 } | 25 } |
| 25 | 26 |
| 26 void FakeBluetoothMediaEndpointServiceProvider::SetConfiguration( | 27 void FakeBluetoothMediaEndpointServiceProvider::SetConfiguration( |
| 27 const dbus::ObjectPath& transport_path, | 28 const ObjectPath& transport_path, |
| 28 const dbus::MessageReader& properties) { | 29 const Delegate::TransportProperties& properties) { |
| 29 VLOG(1) << object_path_.value() << ": SetConfiguration for " | 30 VLOG(1) << object_path_.value() << ": SetConfiguration for " |
| 30 << transport_path.value(); | 31 << transport_path.value(); |
| 32 |
| 33 // Makes the transport object valid for the given endpoint path. |
| 34 FakeBluetoothMediaTransportClient* transport = |
| 35 static_cast<FakeBluetoothMediaTransportClient*>( |
| 36 DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); |
| 37 transport->SetValid(object_path_, true); |
| 38 |
| 31 delegate_->SetConfiguration(transport_path, properties); | 39 delegate_->SetConfiguration(transport_path, properties); |
| 32 } | 40 } |
| 33 | 41 |
| 34 void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration( | 42 void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration( |
| 35 const std::vector<uint8_t>& capabilities, | 43 const std::vector<uint8_t>& capabilities, |
| 36 const Delegate::SelectConfigurationCallback& callback) { | 44 const Delegate::SelectConfigurationCallback& callback) { |
| 37 VLOG(1) << object_path_.value() << ": SelectConfiguration"; | 45 VLOG(1) << object_path_.value() << ": SelectConfiguration"; |
| 38 delegate_->SelectConfiguration(capabilities, callback); | 46 delegate_->SelectConfiguration(capabilities, callback); |
| 39 } | 47 } |
| 40 | 48 |
| 41 void FakeBluetoothMediaEndpointServiceProvider::ClearConfiguration( | 49 void FakeBluetoothMediaEndpointServiceProvider::ClearConfiguration( |
| 42 const dbus::ObjectPath& transport_path) { | 50 const ObjectPath& transport_path) { |
| 43 VLOG(1) << object_path_.value() << ": ClearConfiguration for" | 51 VLOG(1) << object_path_.value() << ": ClearConfiguration on " |
| 44 << transport_path.value(); | 52 << transport_path.value(); |
| 45 delegate_->ClearConfiguration(transport_path); | 53 delegate_->ClearConfiguration(transport_path); |
| 46 } | 54 } |
| 47 | 55 |
| 48 void FakeBluetoothMediaEndpointServiceProvider::Release() { | 56 void FakeBluetoothMediaEndpointServiceProvider::Released() { |
| 49 VLOG(1) << object_path_.value() << ": Release"; | 57 VLOG(1) << object_path_.value() << ": Released"; |
| 50 delegate_->Release(); | 58 delegate_->Released(); |
| 51 } | 59 } |
| 52 | 60 |
| 53 } // namespace chromeos | 61 } // namespace chromeos |
| OLD | NEW |