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

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer.cc

Issue 2452263003: Add DesktopCapturer GetSourceList SelectSource FocusOnSelectedSource functions (Closed)
Patch Set: Created 4 years, 1 month 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 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/desktop_capture/screen_capturer.h"
12
13 #include <memory>
14 #include <utility>
15
16 namespace webrtc {
17
18 ScreenCapturer::~ScreenCapturer() = default;
19
20 bool ScreenCapturer::GetScreenList(ScreenList* screens) {
21 SourceList sources;
22 if (!GetSourceList(&sources)) {
23 return false;
24 }
25
26 for (const Source& source : sources) {
27 if (source.type == SourceType::SCREEN) {
28 screens->push_back({source.screen_id()});
29 }
30 }
31 return true;
32 }
33
34 bool ScreenCapturer::SelectScreen(ScreenId id) {
35 return SelectSource(Source::NewScreen(id));
36 }
37
38 bool ScreenCapturer::GetSourceList(SourceList* sources) {
39 ScreenList screens;
40 if (!GetScreenList(&screens)) {
41 return false;
42 }
43
44 for (const Screen& screen : screens) {
45 sources->push_back(Source::NewScreen(screen.id));
46 }
47
48 return true;
49 }
50
51 bool ScreenCapturer::SelectSource(const Source& source) {
52 if (source.type != SourceType::SCREEN) {
53 return false;
54 }
55
56 return SelectScreen(source.screen_id());
57 }
58
59 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698