| 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 "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" | 5 #include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 15 #include "dbus/exported_object.h" | 16 #include "dbus/exported_object.h" |
| 16 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h" | 17 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h" |
| 17 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 18 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Generates the response to the method call. | 249 // Generates the response to the method call. |
| 249 scoped_ptr<dbus::Response> response( | 250 scoped_ptr<dbus::Response> response( |
| 250 dbus::Response::FromMethodCall(method_call)); | 251 dbus::Response::FromMethodCall(method_call)); |
| 251 dbus::MessageWriter writer(response.get()); | 252 dbus::MessageWriter writer(response.get()); |
| 252 if (configuration.empty()) { | 253 if (configuration.empty()) { |
| 253 LOG(ERROR) << "OnConfiguration called with empty configuration."; | 254 LOG(ERROR) << "OnConfiguration called with empty configuration."; |
| 254 writer.AppendArrayOfBytes(nullptr, 0); | 255 writer.AppendArrayOfBytes(nullptr, 0); |
| 255 } else { | 256 } else { |
| 256 writer.AppendArrayOfBytes(&configuration[0], configuration.size()); | 257 writer.AppendArrayOfBytes(&configuration[0], configuration.size()); |
| 257 } | 258 } |
| 258 response_sender.Run(response.Pass()); | 259 response_sender.Run(std::move(response)); |
| 259 } | 260 } |
| 260 | 261 |
| 261 // Origin thread (i.e. the UI thread in production). | 262 // Origin thread (i.e. the UI thread in production). |
| 262 base::PlatformThreadId origin_thread_id_; | 263 base::PlatformThreadId origin_thread_id_; |
| 263 | 264 |
| 264 // D-Bus Bus object is exported on. | 265 // D-Bus Bus object is exported on. |
| 265 dbus::Bus* bus_; | 266 dbus::Bus* bus_; |
| 266 | 267 |
| 267 // All incoming method calls are passed on to |delegate_|. |callback| passed | 268 // All incoming method calls are passed on to |delegate_|. |callback| passed |
| 268 // to |delegate+| will generate the response for those methods whose returns | 269 // to |delegate+| will generate the response for those methods whose returns |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // Returns a real implementation. | 308 // Returns a real implementation. |
| 308 if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { | 309 if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { |
| 309 return new BluetoothMediaEndpointServiceProviderImpl(bus, object_path, | 310 return new BluetoothMediaEndpointServiceProviderImpl(bus, object_path, |
| 310 delegate); | 311 delegate); |
| 311 } | 312 } |
| 312 // Returns a fake implementation. | 313 // Returns a fake implementation. |
| 313 return new FakeBluetoothMediaEndpointServiceProvider(object_path, delegate); | 314 return new FakeBluetoothMediaEndpointServiceProvider(object_path, delegate); |
| 314 } | 315 } |
| 315 | 316 |
| 316 } // namespace bluez | 317 } // namespace bluez |
| OLD | NEW |