blob: e79519acc29ee40adc9546b0196e6527a733c59f [file] [log] [blame]
Donald E Curtisa8736442015-08-05 15:48:13 -07001/*
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
tkchin9eeb6242016-04-27 01:54:20 -070017#import "WebRTC/RTCSSLAdapter.h"
hjon79858f82016-03-13 22:08:26 -070018
Donald E Curtisa8736442015-08-05 15:48:13 -070019#import "APPRTCViewController.h"
Donald E Curtisa8736442015-08-05 15:48:13 -070020
21@interface APPRTCAppDelegate () <NSWindowDelegate>
22@end
23
24@implementation APPRTCAppDelegate {
25 APPRTCViewController* _viewController;
26 NSWindow* _window;
27}
28
29#pragma mark - NSApplicationDelegate
30
31- (void)applicationDidFinishLaunching:(NSNotification*)notification {
hjon79858f82016-03-13 22:08:26 -070032 RTCInitializeSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070033 NSScreen* screen = [NSScreen mainScreen];
34 NSRect visibleRect = [screen visibleFrame];
35 NSRect windowRect = NSMakeRect(NSMidX(visibleRect),
36 NSMidY(visibleRect),
37 1320,
38 1140);
39 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask;
40 _window = [[NSWindow alloc] initWithContentRect:windowRect
41 styleMask:styleMask
42 backing:NSBackingStoreBuffered
43 defer:NO];
44 _window.delegate = self;
45 [_window makeKeyAndOrderFront:self];
46 [_window makeMainWindow];
47 _viewController = [[APPRTCViewController alloc] initWithNibName:nil
48 bundle:nil];
49 [_window setContentView:[_viewController view]];
50}
51
52#pragma mark - NSWindow
53
54- (void)windowWillClose:(NSNotification*)notification {
55 [_viewController windowWillClose:notification];
hjon79858f82016-03-13 22:08:26 -070056 RTCCleanupSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070057 [NSApp terminate:self];
58}
59
60@end
61