blob: ea6fd733e09294dda5dfa7505d02d76c940a3e7e [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
Donald E Curtisa8736442015-08-05 15:48:13 -070011#import "APPRTCAppDelegate.h"
Donald E Curtisa8736442015-08-05 15:48:13 -070012#import "APPRTCViewController.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020013#import <WebRTC/RTCSSLAdapter.h>
Donald E Curtisa8736442015-08-05 15:48:13 -070014
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 {
hjon79858f82016-03-13 22:08:26 -070026 RTCInitializeSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070027 NSScreen* screen = [NSScreen mainScreen];
28 NSRect visibleRect = [screen visibleFrame];
29 NSRect windowRect = NSMakeRect(NSMidX(visibleRect),
30 NSMidY(visibleRect),
31 1320,
32 1140);
33 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask;
34 _window = [[NSWindow alloc] initWithContentRect:windowRect
35 styleMask:styleMask
36 backing:NSBackingStoreBuffered
37 defer:NO];
38 _window.delegate = self;
39 [_window makeKeyAndOrderFront:self];
40 [_window makeMainWindow];
41 _viewController = [[APPRTCViewController alloc] initWithNibName:nil
42 bundle:nil];
43 [_window setContentView:[_viewController view]];
44}
45
46#pragma mark - NSWindow
47
48- (void)windowWillClose:(NSNotification*)notification {
49 [_viewController windowWillClose:notification];
hjon79858f82016-03-13 22:08:26 -070050 RTCCleanupSSL();
Donald E Curtisa8736442015-08-05 15:48:13 -070051 [NSApp terminate:self];
52}
53
54@end
55