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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H_
7
8 #include "content/browser/renderer_host/media/video_capture_provider.h"
9 #include "services/video_capture/public/interfaces/device_factory.mojom.h"
10
11 namespace content {
12
13 // Routes requests for media devices, e.g. cameras, to
14 // |media_device_capture_provider| and for all other types of capture, e.g.
15 // screen or tab capture, to the given |other_types_capture_provider|.
16 class CONTENT_EXPORT VideoCaptureProviderSwitcher
17 : public VideoCaptureProvider {
18 public:
19 VideoCaptureProviderSwitcher(
20 std::unique_ptr<VideoCaptureProvider> media_device_capture_provider,
21 std::unique_ptr<VideoCaptureProvider> other_types_capture_provider);
22 ~VideoCaptureProviderSwitcher() override;
23
24 void Uninitialize() override;
25
26 void GetDeviceInfosAsync(
27 const base::Callback<void(
28 const std::vector<media::VideoCaptureDeviceInfo>&)>& result_callback)
29 override;
30
31 std::unique_ptr<VideoCaptureDeviceLauncher> CreateDeviceLauncher() override;
32
33 private:
34 std::unique_ptr<VideoCaptureProvider> media_device_capture_provider_;
35 std::unique_ptr<VideoCaptureProvider> other_types_capture_provider_;
36 };
37
38 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
39 : public VideoCaptureDeviceLauncher {
40 public:
41 VideoCaptureDeviceLauncherSwitcher(
42 std::unique_ptr<VideoCaptureDeviceLauncher> media_device_launcher,
43 std::unique_ptr<VideoCaptureDeviceLauncher> other_types_launcher);
44 ~VideoCaptureDeviceLauncherSwitcher() override;
45
46 void LaunchDeviceAsync(const std::string& device_id,
47 MediaStreamType stream_type,
48 const media::VideoCaptureParams& params,
49 base::WeakPtr<media::VideoFrameReceiver> receiver,
50 Callbacks* callbacks,
51 base::OnceClosure done_cb) override;
52
53 void AbortLaunch() override;
54
55 private:
56 std::unique_ptr<VideoCaptureDeviceLauncher> media_device_launcher_;
57 std::unique_ptr<VideoCaptureDeviceLauncher> other_types_launcher_;
58 base::Optional<MediaStreamType> last_launched_stream_type_;
59 };
60
61 } // namespace content
62
63 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_PROVIDER_SWITCHER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698