AboutViewController.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2016 ZeroTier, Inc. https://www.zerotier.com/
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #import "AboutViewController.h"
  19. @interface AboutViewController ()
  20. @end
  21. @implementation AboutViewController
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. [self.webView setWantsLayer:YES];
  25. self.webView.layer.borderWidth = 1.0f;
  26. [self.webView.layer setCornerRadius:1.0f];
  27. self.webView.layer.masksToBounds = YES;
  28. [self.webView.layer setBorderColor:[[NSColor darkGrayColor] CGColor]];
  29. NSBundle *bundle = [NSBundle mainBundle];
  30. NSURL *path = [bundle URLForResource:@"about" withExtension:@"html"];
  31. if(path) {
  32. [self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:path]];
  33. }
  34. }
  35. - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
  36. request:(NSURLRequest *)request
  37. frame:(WebFrame *)frame
  38. decisionListener:(id<WebPolicyDecisionListener>)listener
  39. {
  40. if(request.URL != nil && request.URL.host != nil) {
  41. [[NSWorkspace sharedWorkspace] openURL:request.URL];
  42. }
  43. else {
  44. [listener use];
  45. }
  46. }
  47. @end