blob: 20e6c274c1a1ca0157aefbe993ea466be53875f0 [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"
Donald E Curtisa8736442015-08-05 15:48:13 -070016#import "APPRTCViewController.h"
kthelgason314bc5f2016-08-31 10:23:27 -070017#import "WebRTC/RTCSSLAdapter.h"
Donald E Curtisa8736442015-08-05 15:48:13 -070018
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 {
hjon79858f82016-03-13 22:08:26 -070030 RTCInitializeSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070031 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];
hjon79858f82016-03-13 22:08:26 -070054 RTCCleanupSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070055 [NSApp terminate:self];
56}
57
58@end
59