OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "services/video_capture/video_capture_device_factory_impl.h" | 9 #include "services/video_capture/video_capture_device_factory_impl.h" |
10 | 10 |
11 namespace video_capture { | 11 namespace video_capture { |
12 | 12 |
13 VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry( | 13 VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry( |
14 mojom::VideoCaptureDeviceDescriptorPtr descriptor, | 14 mojom::VideoCaptureDeviceDescriptorPtr descriptor, |
15 std::unique_ptr<VideoCaptureDeviceImpl> bindable_target) | 15 std::unique_ptr<VideoCaptureDeviceProxyImpl> bindable_target) |
16 : descriptor_(std::move(descriptor)), device_(std::move(bindable_target)) {} | 16 : descriptor_(std::move(descriptor)), |
| 17 device_proxy_(std::move(bindable_target)) {} |
17 | 18 |
18 VideoCaptureDeviceFactoryImpl::DeviceEntry::~DeviceEntry() = default; | 19 VideoCaptureDeviceFactoryImpl::DeviceEntry::~DeviceEntry() = default; |
19 | 20 |
20 VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry( | 21 VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry( |
21 VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default; | 22 VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default; |
22 | 23 |
23 VideoCaptureDeviceFactoryImpl::DeviceEntry& | 24 VideoCaptureDeviceFactoryImpl::DeviceEntry& |
24 VideoCaptureDeviceFactoryImpl::DeviceEntry::operator=( | 25 VideoCaptureDeviceFactoryImpl::DeviceEntry::operator=( |
25 VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default; | 26 VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default; |
26 | 27 |
27 mojom::VideoCaptureDeviceDescriptorPtr | 28 mojom::VideoCaptureDeviceDescriptorPtr |
28 VideoCaptureDeviceFactoryImpl::DeviceEntry::MakeDescriptorCopy() const { | 29 VideoCaptureDeviceFactoryImpl::DeviceEntry::MakeDescriptorCopy() const { |
29 return descriptor_.Clone(); | 30 return descriptor_.Clone(); |
30 } | 31 } |
31 | 32 |
32 VideoCaptureDeviceFactoryImpl::VideoCaptureDeviceFactoryImpl() = default; | 33 VideoCaptureDeviceFactoryImpl::VideoCaptureDeviceFactoryImpl() = default; |
33 | 34 |
34 VideoCaptureDeviceFactoryImpl::~VideoCaptureDeviceFactoryImpl() = default; | 35 VideoCaptureDeviceFactoryImpl::~VideoCaptureDeviceFactoryImpl() = default; |
35 | 36 |
36 void VideoCaptureDeviceFactoryImpl::AddDevice( | 37 void VideoCaptureDeviceFactoryImpl::AddDevice( |
37 mojom::VideoCaptureDeviceDescriptorPtr descriptor, | 38 mojom::VideoCaptureDeviceDescriptorPtr descriptor, |
38 std::unique_ptr<VideoCaptureDeviceImpl> device) { | 39 std::unique_ptr<VideoCaptureDeviceProxyImpl> device) { |
39 devices_.emplace_back(std::move(descriptor), std::move(device)); | 40 devices_.emplace_back(std::move(descriptor), std::move(device)); |
40 } | 41 } |
41 | 42 |
42 void VideoCaptureDeviceFactoryImpl::EnumerateDeviceDescriptors( | 43 void VideoCaptureDeviceFactoryImpl::EnumerateDeviceDescriptors( |
43 const EnumerateDeviceDescriptorsCallback& callback) { | 44 const EnumerateDeviceDescriptorsCallback& callback) { |
44 std::vector<mojom::VideoCaptureDeviceDescriptorPtr> descriptors; | 45 std::vector<mojom::VideoCaptureDeviceDescriptorPtr> descriptors; |
45 for (const auto& entry : devices_) | 46 for (const auto& entry : devices_) |
46 descriptors.push_back(entry.MakeDescriptorCopy()); | 47 descriptors.push_back(entry.MakeDescriptorCopy()); |
47 callback.Run(std::move(descriptors)); | 48 callback.Run(std::move(descriptors)); |
48 } | 49 } |
49 | 50 |
50 void VideoCaptureDeviceFactoryImpl::GetSupportedFormats( | 51 void VideoCaptureDeviceFactoryImpl::GetSupportedFormats( |
51 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, | 52 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, |
52 const GetSupportedFormatsCallback& callback) { | 53 const GetSupportedFormatsCallback& callback) { |
53 NOTIMPLEMENTED(); | 54 NOTIMPLEMENTED(); |
54 } | 55 } |
55 | 56 |
56 void VideoCaptureDeviceFactoryImpl::CreateDevice( | 57 void VideoCaptureDeviceFactoryImpl::CreateDeviceProxy( |
57 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, | 58 mojom::VideoCaptureDeviceDescriptorPtr device_descriptor, |
58 mojom::VideoCaptureDeviceRequest request, | 59 mojom::VideoCaptureDeviceProxyRequest request, |
59 const CreateDeviceCallback& callback) { | 60 const CreateDeviceProxyCallback& callback) { |
60 callback.Run(mojom::DeviceAccessResultCode::SUCCESS); | 61 callback.Run(mojom::DeviceAccessResultCode::SUCCESS); |
61 } | 62 } |
62 | 63 |
63 } // namespace video_capture | 64 } // namespace video_capture |
OLD | NEW |