Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1235)

Unified Diff: content/browser/renderer_host/media/video_capture_provider_switcher.h

Issue 2867213004: [Mojo Video Capture] Hook up video capture service behind a feature flag (Closed)
Patch Set: Fix mojo::MakeRequest(&device) happening after base::Passed(&device). Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_provider_switcher.h
diff --git a/content/browser/renderer_host/media/video_capture_provider_switcher.h b/content/browser/renderer_host/media/video_capture_provider_switcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..e676e3040dbbc1b2f2a1be7aeb63e5c7798446c3
--- /dev/null
+++ b/content/browser/renderer_host/media/video_capture_provider_switcher.h
@@ -0,0 +1,63 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
mcasas 2017/05/10 02:33:33 s/2016/2017/
chfremer 2017/05/10 17:59:39 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H_
+
+#include "content/browser/renderer_host/media/video_capture_provider.h"
+#include "services/video_capture/public/interfaces/device_factory.mojom.h"
+
+namespace content {
+
+// Routes requests for media devices, e.g. cameras, to
+// |media_device_capture_provider| and for all other types of capture, e.g.
+// screen or tab capture, to the given |other_types_capture_provider|.
+class CONTENT_EXPORT VideoCaptureProviderSwitcher
+ : public VideoCaptureProvider {
+ public:
+ VideoCaptureProviderSwitcher(
+ std::unique_ptr<VideoCaptureProvider> media_device_capture_provider,
+ std::unique_ptr<VideoCaptureProvider> other_types_capture_provider);
+ ~VideoCaptureProviderSwitcher() override;
+
+ void Uninitialize() override;
+
+ void GetDeviceInfosAsync(
+ const base::Callback<void(
+ const std::vector<media::VideoCaptureDeviceInfo>&)>& result_callback)
+ override;
+
+ std::unique_ptr<VideoCaptureDeviceLauncher> CreateDeviceLauncher() override;
+
+ private:
+ std::unique_ptr<VideoCaptureProvider> media_device_capture_provider_;
+ std::unique_ptr<VideoCaptureProvider> other_types_capture_provider_;
+};
+
+class CONTENT_EXPORT VideoCaptureDeviceLauncherSwitcher
mcasas 2017/05/10 02:33:33 I'm not sure about having two classes bound togeth
chfremer 2017/05/10 17:59:39 What is your concern about this type of constructi
mcasas 2017/05/10 18:15:44 My concern is what I wrote: "having two classes bo
chfremer 2017/05/10 21:08:05 Ah, two classes in the same file. Yes that is ind
+ : public VideoCaptureDeviceLauncher {
+ public:
+ VideoCaptureDeviceLauncherSwitcher(
+ std::unique_ptr<VideoCaptureDeviceLauncher> media_device_launcher,
+ std::unique_ptr<VideoCaptureDeviceLauncher> other_types_launcher);
+ ~VideoCaptureDeviceLauncherSwitcher() override;
+
+ void LaunchDeviceAsync(const std::string& device_id,
+ MediaStreamType stream_type,
+ const media::VideoCaptureParams& params,
+ base::WeakPtr<media::VideoFrameReceiver> receiver,
+ Callbacks* callbacks,
+ base::OnceClosure done_cb) override;
+
+ void AbortLaunch() override;
+
+ private:
+ std::unique_ptr<VideoCaptureDeviceLauncher> media_device_launcher_;
+ std::unique_ptr<VideoCaptureDeviceLauncher> other_types_launcher_;
+ base::Optional<MediaStreamType> last_launched_stream_type_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H_

Powered by Google App Engine
This is Rietveld 408576698