You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

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