AboutViewController.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. self.webView.policyDelegate = self;
  30. NSBundle *bundle = [NSBundle mainBundle];
  31. NSURL *path = [bundle URLForResource:@"about" withExtension:@"html"];
  32. if(path) {
  33. [self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:path]];
  34. }
  35. }
  36. - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
  37. request:(NSURLRequest *)request
  38. frame:(WebFrame *)frame
  39. decisionListener:(id<WebPolicyDecisionListener>)listener
  40. {
  41. if(request.URL != nil && request.URL.host != nil) {
  42. [[NSWorkspace sharedWorkspace] openURL:request.URL];
  43. }
  44. else {
  45. [listener use];
  46. }
  47. }
  48. @end