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

Side by Side Diff: webrtc/modules/desktop_capture/window_capturer_mac.mm

Issue 2490063002: Remove ScreenCapturer and WindowCapturer (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
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/desktop_capture/window_capturer.h"
12
13 #include <assert.h> 11 #include <assert.h>
14 #include <ApplicationServices/ApplicationServices.h> 12 #include <ApplicationServices/ApplicationServices.h>
15 #include <Cocoa/Cocoa.h> 13 #include <Cocoa/Cocoa.h>
16 #include <CoreFoundation/CoreFoundation.h> 14 #include <CoreFoundation/CoreFoundation.h>
17 15
18 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/macutils.h" 17 #include "webrtc/base/macutils.h"
20 #include "webrtc/base/scoped_ref_ptr.h" 18 #include "webrtc/base/scoped_ref_ptr.h"
19 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
21 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 20 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
22 #include "webrtc/modules/desktop_capture/desktop_frame.h" 21 #include "webrtc/modules/desktop_capture/desktop_frame.h"
23 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" 22 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
24 #include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector. h" 23 #include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector. h"
25 #include "webrtc/modules/desktop_capture/mac/window_list_utils.h" 24 #include "webrtc/modules/desktop_capture/mac/window_list_utils.h"
26 #include "webrtc/system_wrappers/include/logging.h" 25 #include "webrtc/system_wrappers/include/logging.h"
27 26
28 namespace webrtc { 27 namespace webrtc {
29 28
30 namespace { 29 namespace {
31 30
32 // Returns true if the window exists. 31 // Returns true if the window exists.
33 bool IsWindowValid(CGWindowID id) { 32 bool IsWindowValid(CGWindowID id) {
34 CFArrayRef window_id_array = 33 CFArrayRef window_id_array =
35 CFArrayCreate(nullptr, reinterpret_cast<const void**>(&id), 1, nullptr); 34 CFArrayCreate(nullptr, reinterpret_cast<const void**>(&id), 1, nullptr);
36 CFArrayRef window_array = 35 CFArrayRef window_array =
37 CGWindowListCreateDescriptionFromArray(window_id_array); 36 CGWindowListCreateDescriptionFromArray(window_id_array);
38 bool valid = window_array && CFArrayGetCount(window_array); 37 bool valid = window_array && CFArrayGetCount(window_array);
39 CFRelease(window_id_array); 38 CFRelease(window_id_array);
40 CFRelease(window_array); 39 CFRelease(window_array);
41 40
42 return valid; 41 return valid;
43 } 42 }
44 43
45 class WindowCapturerMac : public WindowCapturer { 44 class WindowCapturerMac : public DesktopCapturer {
46 public: 45 public:
47 explicit WindowCapturerMac(rtc::scoped_refptr<FullScreenChromeWindowDetector> 46 explicit WindowCapturerMac(rtc::scoped_refptr<FullScreenChromeWindowDetector>
48 full_screen_chrome_window_detector); 47 full_screen_chrome_window_detector);
49 ~WindowCapturerMac() override; 48 ~WindowCapturerMac() override;
50 49
51 // DesktopCapturer interface. 50 // DesktopCapturer interface.
52 void Start(Callback* callback) override; 51 void Start(Callback* callback) override;
53 void CaptureFrame() override; 52 void CaptureFrame() override;
54 bool GetSourceList(SourceList* sources) override; 53 bool GetSourceList(SourceList* sources) override;
55 bool SelectSource(SourceId id) override; 54 bool SelectSource(SourceId id) override;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 182
184 callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); 183 callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
185 184
186 if (full_screen_chrome_window_detector_) 185 if (full_screen_chrome_window_detector_)
187 full_screen_chrome_window_detector_->UpdateWindowListIfNeeded(window_id_); 186 full_screen_chrome_window_detector_->UpdateWindowListIfNeeded(window_id_);
188 } 187 }
189 188
190 } // namespace 189 } // namespace
191 190
192 // static 191 // static
193 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) {
194 return new WindowCapturerMac(options.full_screen_chrome_window_detector());
195 }
196
197 // static
198 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( 192 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
199 const DesktopCaptureOptions& options) { 193 const DesktopCaptureOptions& options) {
200 return std::unique_ptr<DesktopCapturer>( 194 return std::unique_ptr<DesktopCapturer>(
201 new WindowCapturerMac(options.full_screen_chrome_window_detector())); 195 new WindowCapturerMac(options.full_screen_chrome_window_detector()));
202 } 196 }
203 197
204 } // namespace webrtc 198 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/window_capturer.cc ('k') | webrtc/modules/desktop_capture/window_capturer_null.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698