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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_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/desktop_capturer.h"
12
13 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
14 #include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h"
15
16 namespace webrtc {
17
18 WindowId DesktopCapturer::Source::window_id() const {
19 return id;
20 }
21
22 ScreenId DesktopCapturer::Source::screen_id() const {
23 return id;
24 }
25
26 bool DesktopCapturer::Source::operator<(const Source& other) const {
27 if (type == other.type) {
28 return id < other.id;
29 }
30
31 return type < other.type;
32 }
33
34 bool DesktopCapturer::Source::operator>(const Source& other) const {
35 return (*this != other) && !(*this < other);
36 }
37
38 bool DesktopCapturer::Source::operator==(const Source& other) const {
39 if (type != other.type) {
40 return false;
41 }
42
43 return id == other.id;
44 }
45
46 bool DesktopCapturer::Source::operator!=(const Source& other) const {
47 return !(*this == other);
48 }
49
50 // static
51 DesktopCapturer::Source DesktopCapturer::Source::NewWindow(
52 WindowId id,
53 const std::string& title) {
54 // MSVC and android-g++ does not support C99 structure initialization.
Sergey Ulanov 2016/10/28 15:53:21 This is a not a good reason to use ifdef. The firs
Hzj_jie 2016/10/28 22:03:53 Done.
55 #if defined(_MSC_VER) || defined(WEBRTC_ANDROID)
56 Source result;
57 result.type = SourceType::WINDOW;
58 result.id = id;
59 result.title = title;
60 return result;
61 #else
62 return Source{.type = SourceType::WINDOW, .id = id, .title = title};
63 #endif
64 }
65
66 // static
67 DesktopCapturer::Source DesktopCapturer::Source::NewScreen(ScreenId id) {
68 // MSVC and android-g++ does not support C99 structure initialization.
69 #if defined(_MSC_VER) || defined(WEBRTC_ANDROID)
70 Source result;
71 result.type = SourceType::SCREEN;
72 result.id = id;
73 return result;
74 #else
75 return Source{.type = SourceType::SCREEN, .id = id};
76 #endif
77 }
78
79 DesktopCapturer::~DesktopCapturer() = default;
80
81 void DesktopCapturer::SetSharedMemoryFactory(
82 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
83
84 void DesktopCapturer::SetExcludedWindow(WindowId window) {}
85
86 bool DesktopCapturer::GetSourceList(SourceList* sources) {
87 return true;
88 }
89
90 bool DesktopCapturer::SelectSource(const Source& source) {
91 return false;
92 }
93
94 bool DesktopCapturer::FocusOnSelectedSource() {
95 return false;
96 }
97
98 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698