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