OLD | NEW |
| (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/window_capturer.h" | |
12 | |
13 #include <string> | |
14 #include <utility> | |
15 | |
16 namespace webrtc { | |
17 | |
18 WindowCapturer::~WindowCapturer() = default; | |
19 | |
20 bool WindowCapturer::GetWindowList(WindowList* windows) { | |
21 SourceList sources; | |
22 if (!GetSourceList(&sources)) { | |
23 return false; | |
24 } | |
25 | |
26 for (const Source& source : sources) { | |
27 windows->push_back({source.id, std::move(source.title)}); | |
28 } | |
29 return true; | |
30 } | |
31 | |
32 bool WindowCapturer::SelectWindow(WindowId id) { | |
33 return SelectSource(id); | |
34 } | |
35 | |
36 bool WindowCapturer::BringSelectedWindowToFront() { | |
37 return FocusOnSelectedSource(); | |
38 } | |
39 | |
40 bool WindowCapturer::GetSourceList(SourceList* sources) { | |
41 WindowList windows; | |
42 if (!GetWindowList(&windows)) { | |
43 return false; | |
44 } | |
45 | |
46 for (const Window& window : windows) { | |
47 sources->push_back({window.id, std::move(window.title)}); | |
48 } | |
49 | |
50 return true; | |
51 } | |
52 | |
53 bool WindowCapturer::SelectSource(SourceId id) { | |
54 return SelectWindow(id); | |
55 } | |
56 | |
57 bool WindowCapturer::FocusOnSelectedSource() { | |
58 return BringSelectedWindowToFront(); | |
59 } | |
60 | |
61 } // namespace webrtc | |
OLD | NEW |