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

Side by Side Diff: webrtc/modules/video_render/mac/cocoa_full_screen_window.mm

Issue 1929223003: Reland of Delete video_render module. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 /*
2 * Copyright (c) 2012 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/video_render/mac/cocoa_full_screen_window.h"
12 #include "webrtc/system_wrappers/include/trace.h"
13
14 using namespace webrtc;
15
16 @implementation CocoaFullScreenWindow
17
18 -(id)init{
19
20 self = [super init];
21 if(!self){
22 WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, 0, "%s:%d COULD N OT CREATE INSTANCE", __FUNCTION__, __LINE__);
23 return nil;
24 }
25
26
27 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, 0, "%s:%d Created instance ", __FUNCTION__, __LINE__);
28 return self;
29 }
30
31 -(void)grabFullScreen{
32
33 #ifdef GRAB_ALL_SCREENS
34 if(CGCaptureAllDisplays() != kCGErrorSuccess)
35 #else
36 if(CGDisplayCapture(kCGDirectMainDisplay) != kCGErrorSuccess)
37 #endif
38 {
39 WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, 0, "%s:%d Could n ot capture main level", __FUNCTION__, __LINE__);
40 }
41
42 // get the shielding window level
43 int windowLevel = CGShieldingWindowLevel();
44
45 // get the screen rect of main display
46 NSRect screenRect = [[NSScreen mainScreen]frame];
47
48 _window = [[NSWindow alloc]initWithContentRect:screenRect
49 styleMask:NSBorderlessWindowMask
50 backing:NSBackingStoreBuffered
51 defer:NO
52 screen:[NSScreen mainScreen]];
53
54 [_window setLevel:windowLevel];
55 [_window setBackgroundColor:[NSColor blackColor]];
56 [_window makeKeyAndOrderFront:nil];
57
58 }
59
60 -(void)releaseFullScreen
61 {
62 [_window orderOut:self];
63
64 #ifdef GRAB_ALL_SCREENS
65 if(CGReleaseAllDisplays() != kCGErrorSuccess)
66 #else
67 if(CGDisplayRelease(kCGDirectMainDisplay) != kCGErrorSuccess)
68 #endif
69 {
70 WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, 0, "%s:%d Could n ot release the displays", __FUNCTION__, __LINE__);
71 }
72 }
73
74 - (NSWindow*)window
75 {
76 return _window;
77 }
78
79 - (void) dealloc
80 {
81 [self releaseFullScreen];
82 [super dealloc];
83 }
84
85
86
87 @end
OLDNEW
« no previous file with comments | « webrtc/modules/video_render/mac/cocoa_full_screen_window.h ('k') | webrtc/modules/video_render/mac/cocoa_render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698