| Index: services/video_capture/video_capture_device_factory_impl.cc
|
| diff --git a/services/video_capture/video_capture_device_factory_impl.cc b/services/video_capture/video_capture_device_factory_impl.cc
|
| deleted file mode 100644
|
| index 3b57134edc2ca5e4c7b4528580e273528923c4e5..0000000000000000000000000000000000000000
|
| --- a/services/video_capture/video_capture_device_factory_impl.cc
|
| +++ /dev/null
|
| @@ -1,123 +0,0 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "services/video_capture/video_capture_device_factory_impl.h"
|
| -
|
| -#include <sstream>
|
| -
|
| -#include "base/logging.h"
|
| -#include "base/strings/stringprintf.h"
|
| -#include "media/capture/video/fake_video_capture_device.h"
|
| -#include "services/video_capture/device_mock_to_media_adapter.h"
|
| -
|
| -namespace video_capture {
|
| -
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry(
|
| - const media::VideoCaptureDeviceDescriptor& descriptor,
|
| - std::unique_ptr<VideoCaptureDeviceProxyImpl> bindable_target)
|
| - : descriptor_(std::move(descriptor)),
|
| - binding_(base::MakeUnique<mojo::Binding<mojom::VideoCaptureDeviceProxy>>(
|
| - bindable_target.get())) {
|
| - device_proxy_ = std::move(bindable_target);
|
| -}
|
| -
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry::~DeviceEntry() = default;
|
| -
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry::DeviceEntry(
|
| - VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default;
|
| -
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry&
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry::operator=(
|
| - VideoCaptureDeviceFactoryImpl::DeviceEntry&& other) = default;
|
| -
|
| -const media::VideoCaptureDeviceDescriptor&
|
| -VideoCaptureDeviceFactoryImpl::DeviceEntry::descriptor() const {
|
| - return descriptor_;
|
| -}
|
| -
|
| -bool VideoCaptureDeviceFactoryImpl::DeviceEntry::DescriptorEquals(
|
| - const media::VideoCaptureDeviceDescriptor& other) const {
|
| - return descriptor_ == other;
|
| -}
|
| -
|
| -bool VideoCaptureDeviceFactoryImpl::DeviceEntry::is_bound() const {
|
| - return binding_->is_bound();
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::DeviceEntry::Bind(
|
| - mojom::VideoCaptureDeviceProxyRequest request) {
|
| - binding_->Bind(std::move(request));
|
| - binding_->set_connection_error_handler(base::Bind(
|
| - &VideoCaptureDeviceFactoryImpl::DeviceEntry::OnConnectionErrorOrClose,
|
| - base::Unretained(this)));
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::DeviceEntry::Unbind() {
|
| - binding_->Unbind();
|
| - device_proxy_->Stop();
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::DeviceEntry::OnConnectionErrorOrClose() {
|
| - Unbind();
|
| -}
|
| -
|
| -VideoCaptureDeviceFactoryImpl::VideoCaptureDeviceFactoryImpl(
|
| - const media::VideoCaptureJpegDecoderFactoryCB&
|
| - jpeg_decoder_factory_callback)
|
| - : jpeg_decoder_factory_callback_(jpeg_decoder_factory_callback) {}
|
| -
|
| -VideoCaptureDeviceFactoryImpl::~VideoCaptureDeviceFactoryImpl() = default;
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::AddMojoDevice(
|
| - std::unique_ptr<VideoCaptureDeviceProxyImpl> device,
|
| - const media::VideoCaptureDeviceDescriptor& descriptor) {
|
| - devices_.emplace_back(std::move(descriptor), std::move(device));
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::AddMediaDevice(
|
| - std::unique_ptr<media::VideoCaptureDevice> device,
|
| - const media::VideoCaptureDeviceDescriptor& descriptor) {
|
| - AddMojoDevice(base::MakeUnique<VideoCaptureDeviceProxyImpl>(
|
| - std::move(device), jpeg_decoder_factory_callback_),
|
| - std::move(descriptor));
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::AddMockDevice(
|
| - mojom::MockVideoCaptureDevicePtr device,
|
| - const media::VideoCaptureDeviceDescriptor& descriptor) {
|
| - AddMediaDevice(base::MakeUnique<DeviceMockToMediaAdapter>(std::move(device)),
|
| - std::move(descriptor));
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::EnumerateDeviceDescriptors(
|
| - const EnumerateDeviceDescriptorsCallback& callback) {
|
| - std::vector<media::VideoCaptureDeviceDescriptor> descriptors;
|
| - for (const auto& entry : devices_)
|
| - descriptors.push_back(entry.descriptor());
|
| - callback.Run(std::move(descriptors));
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::GetSupportedFormats(
|
| - const media::VideoCaptureDeviceDescriptor& device_descriptor,
|
| - const GetSupportedFormatsCallback& callback) {
|
| - NOTIMPLEMENTED();
|
| -}
|
| -
|
| -void VideoCaptureDeviceFactoryImpl::CreateDeviceProxy(
|
| - const media::VideoCaptureDeviceDescriptor& device_descriptor,
|
| - mojom::VideoCaptureDeviceProxyRequest proxy_request,
|
| - const CreateDeviceProxyCallback& callback) {
|
| - for (auto& entry : devices_) {
|
| - if (entry.DescriptorEquals(device_descriptor)) {
|
| - if (entry.is_bound())
|
| - entry.Unbind();
|
| - entry.Bind(std::move(proxy_request));
|
| - callback.Run(mojom::DeviceAccessResultCode::SUCCESS);
|
| - return;
|
| - }
|
| - }
|
| - callback.Run(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND);
|
| -}
|
| -
|
| -} // namespace video_capture
|
|
|