| OLD | NEW |
| (Empty) |
| 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 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 12 #error "This file requires ARC support." | |
| 13 #endif | |
| 14 | |
| 15 #import "APPRTCAppDelegate.h" | |
| 16 #import "APPRTCViewController.h" | |
| 17 #import "WebRTC/RTCSSLAdapter.h" | |
| 18 | |
| 19 @interface APPRTCAppDelegate () <NSWindowDelegate> | |
| 20 @end | |
| 21 | |
| 22 @implementation APPRTCAppDelegate { | |
| 23 APPRTCViewController* _viewController; | |
| 24 NSWindow* _window; | |
| 25 } | |
| 26 | |
| 27 #pragma mark - NSApplicationDelegate | |
| 28 | |
| 29 - (void)applicationDidFinishLaunching:(NSNotification*)notification { | |
| 30 RTCInitializeSSL(); | |
| 31 NSScreen* screen = [NSScreen mainScreen]; | |
| 32 NSRect visibleRect = [screen visibleFrame]; | |
| 33 NSRect windowRect = NSMakeRect(NSMidX(visibleRect), | |
| 34 NSMidY(visibleRect), | |
| 35 1320, | |
| 36 1140); | |
| 37 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask; | |
| 38 _window = [[NSWindow alloc] initWithContentRect:windowRect | |
| 39 styleMask:styleMask | |
| 40 backing:NSBackingStoreBuffered | |
| 41 defer:NO]; | |
| 42 _window.delegate = self; | |
| 43 [_window makeKeyAndOrderFront:self]; | |
| 44 [_window makeMainWindow]; | |
| 45 _viewController = [[APPRTCViewController alloc] initWithNibName:nil | |
| 46 bundle:nil]; | |
| 47 [_window setContentView:[_viewController view]]; | |
| 48 } | |
| 49 | |
| 50 #pragma mark - NSWindow | |
| 51 | |
| 52 - (void)windowWillClose:(NSNotification*)notification { | |
| 53 [_viewController windowWillClose:notification]; | |
| 54 RTCCleanupSSL(); | |
| 55 [NSApp terminate:self]; | |
| 56 } | |
| 57 | |
| 58 @end | |
| 59 | |
| OLD | NEW |