APPRTCAppDelegate.m (1801B)
1 /* 2 * Copyright 2014 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 #import "APPRTCAppDelegate.h" 12 #import "APPRTCViewController.h" 13 #import "sdk/objc/api/peerconnection/RTCSSLAdapter.h" 14 15 @interface APPRTCAppDelegate () <NSWindowDelegate> 16 @end 17 18 @implementation APPRTCAppDelegate { 19 APPRTCViewController* _viewController; 20 NSWindow* _window; 21 } 22 23 #pragma mark - NSApplicationDelegate 24 25 - (void)applicationDidFinishLaunching:(NSNotification*)notification { 26 RTCInitializeSSL(); 27 NSScreen* screen = [NSScreen mainScreen]; 28 NSRect visibleRect = [screen visibleFrame]; 29 NSRect windowRect = 30 NSMakeRect(NSMidX(visibleRect), NSMidY(visibleRect), 1320, 1140); 31 NSUInteger styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable; 32 _window = [[NSWindow alloc] initWithContentRect:windowRect 33 styleMask:styleMask 34 backing:NSBackingStoreBuffered 35 defer:NO]; 36 _window.delegate = self; 37 [_window makeKeyAndOrderFront:self]; 38 [_window makeMainWindow]; 39 _viewController = [[APPRTCViewController alloc] initWithNibName:nil 40 bundle:nil]; 41 [_window setContentView:[_viewController view]]; 42 } 43 44 #pragma mark - NSWindow 45 46 - (void)windowWillClose:(NSNotification*)notification { 47 [_viewController windowWillClose:notification]; 48 RTCCleanupSSL(); 49 [NSApp terminate:self]; 50 } 51 52 @end