Chromium Code Reviews| 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 // Sets the visibility to the transport object to true if the media object | |
|
Miao
2015/02/10 22:49:11
Update comment in patch 3.
Miao
2015/02/11 23:17:17
Done.
| |
| 34 // is valid. | |
| 35 FakeBluetoothMediaTransportClient* transport = | |
| 36 static_cast<FakeBluetoothMediaTransportClient*>( | |
| 37 DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); | |
| 38 transport->SetValid(object_path_, true); | |
| 39 | |
| 31 delegate_->SetConfiguration(transport_path, properties); | 40 delegate_->SetConfiguration(transport_path, properties); |
| 32 } | 41 } |
| 33 | 42 |
| 34 void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration( | 43 void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration( |
| 35 const std::vector<uint8_t>& capabilities, | 44 const std::vector<uint8_t>& capabilities, |
| 36 const Delegate::SelectConfigurationCallback& callback) { | 45 const Delegate::SelectConfigurationCallback& callback) { |
| 37 VLOG(1) << object_path_.value() << ": SelectConfiguration"; | 46 VLOG(1) << object_path_.value() << ": SelectConfiguration"; |
| 38 delegate_->SelectConfiguration(capabilities, callback); | 47 delegate_->SelectConfiguration(capabilities, callback); |
| 39 } | 48 } |
| 40 | 49 |
| 41 void FakeBluetoothMediaEndpointServiceProvider::ClearConfiguration( | 50 void FakeBluetoothMediaEndpointServiceProvider::ClearConfiguration( |
| 42 const dbus::ObjectPath& transport_path) { | 51 const ObjectPath& transport_path) { |
| 43 VLOG(1) << object_path_.value() << ": ClearConfiguration for" | 52 VLOG(1) << object_path_.value() << ": ClearConfiguration on " |
| 44 << transport_path.value(); | 53 << transport_path.value(); |
| 45 delegate_->ClearConfiguration(transport_path); | 54 delegate_->ClearConfiguration(transport_path); |
| 46 } | 55 } |
| 47 | 56 |
| 48 void FakeBluetoothMediaEndpointServiceProvider::Release() { | 57 void FakeBluetoothMediaEndpointServiceProvider::Released() { |
| 49 VLOG(1) << object_path_.value() << ": Release"; | 58 VLOG(1) << object_path_.value() << ": Released"; |
| 50 delegate_->Release(); | 59 delegate_->Released(); |
| 51 } | 60 } |
| 52 | 61 |
| 53 } // namespace chromeos | 62 } // namespace chromeos |
| OLD | NEW |