Index: content/browser/renderer_host/media/mojo_service_launched_video_capture_device.cc |
diff --git a/content/browser/renderer_host/media/mojo_service_launched_video_capture_device.cc b/content/browser/renderer_host/media/mojo_service_launched_video_capture_device.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..510dd4f71511d3bb88c426230d99b70a750c298f |
--- /dev/null |
+++ b/content/browser/renderer_host/media/mojo_service_launched_video_capture_device.cc |
@@ -0,0 +1,104 @@ |
+// Copyright 2017 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 "content/browser/renderer_host/media/mojo_service_launched_video_capture_device.h" |
+ |
+// #include "content/public/browser/browser_thread.h" |
+// #include "media/capture/video/video_frame_receiver_on_task_runner.h" |
+// #include "mojo/public/cpp/bindings/strong_binding.h" |
+// #include "services/video_capture/public/cpp/receiver_media_to_mojo_adapter.h" |
+// #include |
+// "services/video_capture/public/cpp/device_to_feedback_observer_adapter.h" |
+ |
+namespace content { |
+ |
+MojoServiceLaunchedVideoCaptureDevice::MojoServiceLaunchedVideoCaptureDevice( |
+ video_capture::mojom::DevicePtr device) |
+ : device_(std::move(device)) { |
+ // Unretained |this| is safe, because |this| owns |device_|. |
+ device_.set_connection_error_handler(base::Bind( |
+ &MojoServiceLaunchedVideoCaptureDevice::OnLostConnectionToDevice, |
+ base::Unretained(this))); |
+} |
+ |
+MojoServiceLaunchedVideoCaptureDevice:: |
+ ~MojoServiceLaunchedVideoCaptureDevice() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ device_.reset(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::GetPhotoCapabilities( |
+ media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback) const { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::SetPhotoOptions( |
+ media::mojom::PhotoSettingsPtr settings, |
+ media::VideoCaptureDevice::SetPhotoOptionsCallback callback) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::TakePhoto( |
+ media::VideoCaptureDevice::TakePhotoCallback callback) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::MaybeSuspendDevice() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::ResumeDevice() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::RequestRefreshFrame() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::SetDesktopCaptureWindowIdAsync( |
+ gfx::NativeViewId window_id, |
+ base::OnceClosure done_cb) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ // This method should only be called for desktop capture devices. |
+ // The video_capture Mojo service does not support desktop capture devices |
+ // (yet) and should not be used for it. |
+ NOTREACHED(); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::OnUtilizationReport( |
+ int frame_feedback_id, |
+ double utilization) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ device_->OnReceiverReportingUtilization(frame_feedback_id, utilization); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::OnGetPhotoCapabilitiesResponse( |
+ media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, |
+ media::mojom::PhotoCapabilitiesPtr capabilities) const { |
+ callback.Run(std::move(capabilities)); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::OnSetPhotoOptionsResponse( |
+ media::VideoCaptureDevice::SetPhotoOptionsCallback callback, |
+ bool success) { |
+ callback.Run(success); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::OnTakePhotoResponse( |
+ media::VideoCaptureDevice::TakePhotoCallback callback, |
+ media::mojom::BlobPtr blob) { |
+ callback.Run(std::move(blob)); |
+} |
+ |
+void MojoServiceLaunchedVideoCaptureDevice::OnLostConnectionToDevice() { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+} // namespace content |