2016-06-24 03:22:03 +00:00
|
|
|
//
|
|
|
|
// AboutViewController.swift
|
|
|
|
// ZeroTier One
|
|
|
|
//
|
|
|
|
// Created by Grant Limberg on 6/23/16.
|
|
|
|
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
2016-07-20 02:12:41 +00:00
|
|
|
import WebKit
|
2016-06-24 03:22:03 +00:00
|
|
|
|
2016-07-27 01:21:39 +00:00
|
|
|
class AboutViewController: NSViewController, WebPolicyDelegate {
|
2016-06-24 03:22:03 +00:00
|
|
|
|
2016-07-20 02:12:41 +00:00
|
|
|
|
|
|
|
@IBOutlet var webView: WebView!
|
|
|
|
|
2016-06-24 03:22:03 +00:00
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
2016-07-27 01:21:39 +00:00
|
|
|
|
|
|
|
webView.policyDelegate = self
|
2016-06-24 03:22:03 +00:00
|
|
|
// Do view setup here.
|
2016-07-20 02:12:41 +00:00
|
|
|
let bundle = NSBundle.mainBundle()
|
|
|
|
let path = bundle.URLForResource("about", withExtension: "html")
|
|
|
|
|
|
|
|
if let url = path {
|
|
|
|
webView.mainFrame.loadRequest(NSURLRequest(URL: url))
|
|
|
|
}
|
2016-06-24 03:22:03 +00:00
|
|
|
}
|
2016-07-27 01:21:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
func webView(webView: WebView!,
|
|
|
|
decidePolicyForNavigationAction actionInformation: [NSObject : AnyObject]!,
|
|
|
|
request: NSURLRequest!,
|
|
|
|
frame: WebFrame!,
|
|
|
|
decisionListener listener: WebPolicyDecisionListener!) {
|
|
|
|
if (request.URL?.host) != nil {
|
|
|
|
NSWorkspace.sharedWorkspace().openURL(request.URL!)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
listener.use()
|
|
|
|
}
|
|
|
|
}
|
2016-06-24 03:22:03 +00:00
|
|
|
|
|
|
|
}
|