├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .zipignore ├── LICENSE ├── Makefile ├── Package.swift ├── README.md ├── Sources ├── MacPin │ ├── App.swift │ ├── AppDelegate.swift │ ├── AppScriptRuntime.swift │ ├── BrowserViewController.swift │ ├── CocoaShims.swift │ ├── FavIcon.swift │ ├── Generics.swift │ ├── Geolocator.swift │ ├── Prompter.swift │ ├── Retriever.swift │ ├── WebNotifier.swift │ ├── WebView.swift │ ├── WebViewCallbacks.swift │ ├── WebViewController.swift │ └── WebViewDelegates.swift ├── MacPinIOS │ ├── AppDelegateIOS.swift │ ├── ExtsIOS.swift │ ├── MobileBrowserViewController.swift │ ├── WebViewControllerIOS.swift │ ├── WebViewDelegatesIOS.swift │ └── shared ├── MacPinOSX │ ├── AppDelegateOSX.swift │ ├── BrowserViewControllerOSX.swift │ ├── EffectViewController.swift │ ├── FoundationExts.swift │ ├── OmniBoxController.swift │ ├── Services.swift │ ├── StatusBarController.swift │ ├── TabFlowController.swift │ ├── WebViewControllerOSX.swift │ ├── WebViewDelegatesOSX.swift │ ├── WindowController.swift │ └── shared ├── MacPin_static │ └── main.swift └── MacPin_stub │ └── main.swift ├── Tools └── iconify │ ├── iconify.swift │ └── null.swift ├── apple_dev_id.mk ├── dock_screenshot.png ├── eXcode.mk ├── modules ├── JavaScriptCorePrivates │ ├── JSContextRefPrivate.h │ ├── JSContext_Privates.h │ ├── JSRemoteInspector.h │ ├── JSScript.h │ ├── JSScriptRefPrivate.h │ ├── WebKitAvailability.h │ └── module.modulemap ├── Linenoise │ ├── AnsiCodes.swift │ ├── ControlCharacters.swift │ ├── EditState.swift │ ├── Errors.swift │ ├── History.swift │ ├── Package.swift │ ├── Terminal.swift │ └── linenoise.swift ├── UTIKit │ ├── LICENSE │ ├── Package.swift │ ├── README.md │ └── UTI.swift ├── UserNotificationPrivates │ ├── NSUserNotification+Privates.h │ ├── UserNotificationPrivates.h │ └── module.modulemap ├── ViewPrivates │ ├── NSView+Privates.h │ ├── UIView+Privates.h │ ├── ViewPrivates.h │ └── module.modulemap └── WebKitPrivates │ ├── NSTextFinderSPI.h │ ├── WKBase.h │ ├── WKBaseMac.h │ ├── WKBrowsingContextHandle.h │ ├── WKContext.h │ ├── WKContextPrivate.h │ ├── WKData.h │ ├── WKDeclarationSpecifiers.h │ ├── WKDeprecated.h │ ├── WKDictionary.h │ ├── WKDragDestinationAction.h │ ├── WKErrorPrivate.h │ ├── WKErrorRef.h │ ├── WKEvent.h │ ├── WKFrame.h │ ├── WKGeolocationManager.h │ ├── WKGeolocationPermissionRequest.h │ ├── WKGeolocationPosition.h │ ├── WKGeometry.h │ ├── WKHistoryDelegatePrivate.h │ ├── WKInspector.h │ ├── WKInspectorPrivateMac.h │ ├── WKMutableDictionary.h │ ├── WKNativeEvent.h │ ├── WKNavigationActionPrivate.h │ ├── WKNavigationDelegatePrivate.h │ ├── WKNavigationResponsePrivate.h │ ├── WKNotification.h │ ├── WKNotificationManager.h │ ├── WKNotificationPermissionRequest.h │ ├── WKNotificationProvider.h │ ├── WKNumber.h │ ├── WKObject.h │ ├── WKOpenPanelParameters.h │ ├── WKPage.h │ ├── WKPageUIClient.h │ ├── WKPreferencesPrivate.h │ ├── WKPreferencesRefPrivate.h │ ├── WKProcessPoolPrivate.h │ ├── WKReloadFrameErrorRecoveryAttempter.h │ ├── WKSecurityOriginRef.h │ ├── WKString.h │ ├── WKStringCF.h │ ├── WKType.h │ ├── WKUIDelegatePrivate.h │ ├── WKURL.h │ ├── WKURLCF.h │ ├── WKUserContentControllerPrivate.h │ ├── WKView+Privates.h │ ├── WKWebView+Privates.h │ ├── WKWebViewConfigurationPrivate.h │ ├── WKWebsiteDataStoreConfigurationRef.h │ ├── WKWebsiteDataStorePrivate.h │ ├── WKWebsiteDataStoreRef.h │ ├── WebKitAvailability.h │ ├── WebURLsWithTitles.h │ ├── _WKActivatedElementInfo.h │ ├── _WKApplicationManifest.h │ ├── _WKAttachment.h │ ├── _WKDiagnosticLoggingDelegate.h │ ├── _WKDownload.h │ ├── _WKDownloadDelegate.h │ ├── _WKErrorRecoveryAttempting.h │ ├── _WKFindDelegate.h │ ├── _WKFindOptions.h │ ├── _WKFocusedElementInfo.h │ ├── _WKFormInputSession.h │ ├── _WKHitTestResult.h │ ├── _WKIconLoadingDelegate.h │ ├── _WKInputDelegate.h │ ├── _WKInspector.h │ ├── _WKLayoutMode.h │ ├── _WKLinkIconParameters.h │ ├── _WKProcessPoolConfiguration.h │ ├── _WKRenderingProgressEvents.h │ ├── _WKSameDocumentNavigationType.h │ ├── _WKThumbnailView.h │ ├── _WKUserStyleSheet.h │ ├── _WKWebsiteDataStore.h │ ├── _WKWebsiteDataStoreConfiguration.h │ ├── _WKWebsitePolicies.h │ └── module.modulemap ├── sites ├── DevDocs │ ├── app.js │ └── icon.png ├── Facebook │ ├── app.js │ ├── icon.png │ ├── styler.js │ └── unpreloader.js ├── Google_Calendar │ ├── app.js │ └── icon.png ├── Google_Chat │ ├── icon.png │ └── main.js ├── Google_Drive │ ├── app.js │ └── icon.png ├── Google_Maps │ ├── app.js │ └── icon.png ├── Google_Photos │ ├── app.js │ └── icon.png ├── Google_Voice │ ├── icon.png │ └── main.js ├── Hangouts │ ├── app.js │ ├── convopopper.js │ ├── icon.png │ ├── notifier.js │ ├── screenshot.jpg │ ├── style.css │ └── styler.js ├── MacPin │ ├── Library │ │ └── Script Libraries │ │ │ ├── test.jxa │ │ │ └── test.scpt │ ├── dnd.js │ ├── icon.png │ ├── main.js │ ├── media_player.html │ ├── playground.html │ ├── playgroundFrame.html │ ├── repl.html │ ├── seeDebugger.js │ └── thumbs.js ├── Messenger │ ├── app.js │ └── icon.png ├── Slack │ ├── autodark.css │ ├── icon.png │ └── main.js ├── Stack_Overflow │ ├── app.js │ └── icon.png ├── Trello │ ├── 3Dconnexion Config.3dc │ ├── app.js │ ├── icon.png │ ├── navigator.js │ ├── screenshot.jpg │ └── styler.js ├── Twitter │ ├── app.js │ ├── icon.png │ └── unpreloader.js └── WhatsApp │ ├── app.js │ └── icon.png └── templates ├── Resources ├── Credits.rtf ├── Readability.css ├── Readability.js ├── app_injectTab.js ├── app_repl.js ├── browser-util-inspect.js ├── enDarken.css ├── enDarken.js ├── shim_notification_promises.js ├── string-kit-ansi.js ├── string-kit-escape.js └── string-kit-inspect.js ├── framework └── Info-macOS.plist ├── ios ├── Contents.json.appicon ├── Info.plist ├── InfoPlist.strings ├── LaunchScreen.xib └── entitlements.plist ├── macos ├── Info.plist ├── InfoPlist.strings └── entitlements.plist └── xcassets └── iOS └── icons8 ├── toolbar_automatic.png ├── toolbar_back.png ├── toolbar_cancel.png ├── toolbar_delete_file.png ├── toolbar_document.png ├── toolbar_download.png ├── toolbar_download_from_cloud.png ├── toolbar_exit.png ├── toolbar_export.png ├── toolbar_forward.png ├── toolbar_home.png ├── toolbar_import.png ├── toolbar_menu.png ├── toolbar_open_in_browser.png ├── toolbar_search.png ├── toolbar_trash.png ├── toolbar_upload.png ├── toolbar_virtual_machine.png ├── toolbar_zoom_in.png └── toolbar_zoom_out.png /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: [main] 5 | pull_request: 6 | branches: [main] 7 | 8 | jobs: 9 | macos_big_sur: 10 | runs-on: macos-11 11 | 12 | strategy: 13 | matrix: 14 | xcode: 15 | - "13.2" # Swift 5.5 16 | 17 | name: "macOS Big Sur (Xcode ${{ matrix.xcode }})" 18 | 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v1 22 | - name: Get build paths 23 | id: getpaths 24 | run: | 25 | echo ::set-output name=OUT_PATH::$(make where-out 2>/dev/null | tail -n1) 26 | echo ::set-output name=TXZ_PATH::$(make where-txz 2>/dev/null | tail -n1) 27 | - name: Build All Apps 28 | run: | 29 | make allapps 30 | env: 31 | DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer 32 | - name: Create Package 33 | run: | 34 | make txz 35 | - name: Upload artifact 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: allapps.tar.xz 39 | path: ${{ steps.getpaths.outputs.TXZ_PATH }} 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | */.DS_Store 3 | icons/*/ 4 | build/ 5 | sites.dis/ 6 | sites/VDMS.* 7 | modules.dis/ 8 | .babel/ 9 | -------------------------------------------------------------------------------- /.zipignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | MacPin.app/Contents/Frameworks/MacPin.framework/Versions/A/MacPin.dSYM 3 | -------------------------------------------------------------------------------- /Sources/MacPin/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import JavaScriptCore 2 | 3 | @objc protocol ApplicationDelegateJS: JSExport { 4 | var browserController: BrowserViewController { get set } 5 | } 6 | 7 | protocol MacPinAppDelegate: ApplicationDelegate, ApplicationDelegateJS { 8 | } 9 | -------------------------------------------------------------------------------- /Sources/MacPin/CocoaShims.swift: -------------------------------------------------------------------------------- 1 | /// MacPin CocoaShims 2 | /// 3 | /// Gracefully-degraded Cocoa(Touch) subclasses for shared UI code 4 | #if os(OSX) 5 | 6 | import AppKit 7 | 8 | //class ViewController: NSViewController { 9 | // some sugar to facilitate NIB-less & programmatic instanciation 10 | //required init?(coder: NSCoder) { super.init(coder: coder) } // required by NSCoding protocol 11 | //override init!(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { super.init(nibName:nil, bundle:nil) } //calls loadView 12 | // override failable init?(nibName:) with an implicitly-unwrapped init!(nibName:) to allow `let vc: ViewController = ViewController(nil, bundle:nil)` 13 | 14 | // ViewController subclasses can now implement convenience initializers like: 15 | // convenience init() { self.init(nibName: nil, bundle: nil) } 16 | // convenience init(withFoo: AnyObject) { self.init(); doSomething(withFoo) } 17 | // or do this: http://sketchytech.blogspot.com/2014/09/swift-rules-of-being-required-xcode-6-gm.html 18 | // also, must assign .view from loadView() override: `override func loadView() { view = withFoo }` 19 | //} 20 | 21 | public typealias View = NSView 22 | public typealias ViewController = NSViewController 23 | public typealias Application = NSApplication 24 | public typealias ApplicationDelegate = NSApplicationDelegate 25 | 26 | #elseif os(iOS) 27 | 28 | // adapt OSX AppKit class conventions to iOS UIKit classes 29 | // ala Chameleon (only this is a reverse implementation) 30 | 31 | import UIKit 32 | 33 | public typealias View = UIView 34 | public typealias ViewController = UIViewController 35 | public typealias Application = UIApplication 36 | public typealias ApplicationDelegate = UIApplicationDelegate 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Sources/MacPin/FavIcon.swift: -------------------------------------------------------------------------------- 1 | /// MacPin FavIcon 2 | /// 3 | /// Asyncronously grabs and stores a KVO-able Image from an icon's URL 4 | 5 | #if os(OSX) 6 | 7 | import AppKit 8 | typealias IconImage = NSImage 9 | 10 | #elseif os(iOS) 11 | 12 | import UIKit 13 | typealias IconImage = UIImage 14 | let NSImageNameApplicationIcon = "icon" 15 | 16 | #endif 17 | 18 | @objc class FavIcon: NSObject { 19 | #if os(OSX) 20 | @objc dynamic unowned var icon = NSImage(named: NSImage.applicationIconName)! 21 | //need 24 & 36px**2 representations of the NSImage for bigger grid views 22 | @objc dynamic unowned var icon16 = NSImage(named: NSImage.statusNoneName)! { 23 | willSet { 24 | newValue.size = NSSize(width: 16, height: 16) 25 | } 26 | } 27 | #else 28 | @objc dynamic unowned var icon = UIImage(ciImage: CIImage.empty()) 29 | #endif 30 | 31 | weak var data: NSData? = nil { 32 | didSet { 33 | if let data = data, let img = IconImage(data: data as Data) { 34 | self.icon = img 35 | #if os(OSX) 36 | self.icon16 = img 37 | #endif 38 | } 39 | } 40 | } 41 | @objc dynamic var url: NSURL? = nil { 42 | didSet { 43 | if let url = url { 44 | warn("setting favicon.icon to = \(url)") 45 | FavIcon.grabFavIcon(url) { [unowned self] (data) in 46 | self.data = data 47 | } 48 | } 49 | } 50 | } 51 | 52 | static func grabFavIcon(_ url: NSURL, completion: @escaping ((NSData) -> Void)) { 53 | // http://stackoverflow.com/a/26540173/3878712 54 | // http://jamesonquave.com/blog/developing-ios-apps-using-swift-part-5-async-image-loading-and-caching/ 55 | DispatchQueue.global(qos: .default).async(execute: { // [unowned self] 56 | if let data = NSData(contentsOf: url as URL) { // downloaded from background thread. HTTP error should return nil... 57 | DispatchQueue.main.async(execute: { () -> Void in // return to UI thread to update icon 58 | completion(data) 59 | }) 60 | } 61 | }) 62 | } 63 | 64 | override var description: String { return "<\(type(of: self))> `\(url?.absoluteString ?? "")`" } 65 | //deinit { warn(description) } 66 | /* 67 | convenience init(url: NSURL) { 68 | self.init() 69 | FavIcon.grabFavIcon(url) { (data) in 70 | self.data = data 71 | self.url = url // prop observers don't work from init.... 72 | if let img = IconImage(data: data) { self.icon = img } 73 | } 74 | } 75 | 76 | convenience init?(icon: String) { 77 | if let url = NSURL(string: icon) where !icon.isEmpty { 78 | self.init(url: url) 79 | } else { 80 | return nil 81 | } 82 | } 83 | */ 84 | } 85 | -------------------------------------------------------------------------------- /Sources/MacPin/Prompter.swift: -------------------------------------------------------------------------------- 1 | import Dispatch 2 | import Linenoise 3 | import Foundation 4 | 5 | class Prompter { 6 | var running = false 7 | var prompter: DispatchWorkItem? = nil 8 | var aborter: DispatchWorkItem? = nil 9 | 10 | required init(_ worker: DispatchWorkItem?) { 11 | prompter = worker 12 | } 13 | 14 | func start() { 15 | guard let prompter = prompter, running == false else { return } 16 | DispatchQueue.global(qos: .userInteractive).async(execute: prompter) 17 | self.running = true 18 | 19 | if let aborter = aborter { 20 | prompter.notify(queue: .main, execute: aborter) 21 | aborter.notify(queue: .main) { 22 | self.running = false 23 | } 24 | } 25 | } 26 | 27 | func wait() { 28 | guard let prompter = prompter, running == false else { return } 29 | prompter.wait() 30 | } 31 | 32 | // TODO: exposing a websocketREPL would also be neat: https://github.com/siuying/IGJavaScriptConsole https://github.com/zwopple/PocketSocket 33 | class func termiosREPL(_ eval:((String)->Void)? = nil, ps1: StaticString = #file, ps2: StaticString = #function, abort:(()->(()->Void)?)? = nil) -> Prompter { 34 | var final: (()->Void)? = nil 35 | let prompter = DispatchWorkItem { 36 | let ln = LineNoise(outputFile: STDERR_FILENO) 37 | if ln.mode != .supportedTTY { 38 | warn("linenoise did not detect a TTY-as-stdin, Prompter disabled.") 39 | return 40 | } 41 | var done = false 42 | let prompt = "<\(CommandLine.arguments[0])> % " 43 | while (!done) { 44 | do { 45 | let line = try ln.getLine(prompt: prompt) // R: blocks here until Enter pressed 46 | if !line.hasPrefix("\n") { 47 | //print("| ") // result prefix 48 | ln.addHistory(line) 49 | g_stdErr.write("\n") 50 | DispatchQueue.main.sync { 51 | // JS can mutate native UI objects that are not BG-thread-safe 52 | eval?(line) // E:, P: 53 | } 54 | } 55 | } catch LinenoiseError.EOF { 56 | // stdin closed or EOF'd 57 | if abort == nil { g_stdErr.write("\(ps1): got closed from stdin, stopping \(ps2)") } 58 | done = true 59 | } catch LinenoiseError.CTRL_C { 60 | // stdin CTRL-C'd 61 | if abort == nil { g_stdErr.write("\(ps1): got closed from stdin, stopping \(ps2)") } 62 | done = true 63 | } catch { 64 | g_stdErr.write(error.localizedDescription + "\n") 65 | done = true // best to just stop 66 | } 67 | // L: command dispatched, restart loop 68 | } 69 | } 70 | 71 | var inst = Prompter(prompter) 72 | if let abort = abort, let final = abort() { 73 | inst.aborter = DispatchWorkItem { final() } 74 | } 75 | return inst 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Sources/MacPin/Retriever.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import WebKit 3 | 4 | @available(macOS 10.13, iOS 10, *) 5 | class MPRetriever: NSObject, WKURLSchemeHandler { 6 | @objc func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) { 7 | warn() 8 | //urlSchemeTask.didReceive(URLResponse(...)) 9 | urlSchemeTask.didFinish() 10 | } 11 | @objc func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) { warn() } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/MacPin/WebViewController.swift: -------------------------------------------------------------------------------- 1 | /// MacPin WebViewController 2 | /// 3 | /// Interlocute WebViews to general app UI 4 | 5 | import WebKit 6 | import WebKitPrivates 7 | import JavaScriptCore 8 | 9 | // https://github.com/apple/swift-evolution/blob/master/proposals/0160-objc-inference.md#re-enabling-objc-inference-within-a-class-hierarchy 10 | @objcMembers 11 | class WebViewController: ViewController { //, WebViewControllerScriptExports { 12 | @objc unowned var webview: MPWebView 13 | 14 | #if os(OSX) 15 | override func loadView() { view = NSView() } // NIBless 16 | #endif 17 | 18 | let browsingReactor = AppScriptRuntime.shared 19 | // ^ this is a simple object that can re-broadcast events from the webview and return with confirmation that those events were "handled" or not. 20 | // this lets the controller know whether it should perform "reasonable browser-like actions" or to defer to the Reactor's business logic. 21 | 22 | required init?(coder: NSCoder) { self.webview = MPWebView(); super.init(coder: coder); } // required by NSCoding protocol 23 | 24 | #if os(OSX) 25 | override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) { self.webview = MPWebView(); super.init(nibName:nil, bundle:nil) } //calls loadView 26 | #endif 27 | required init(webview: MPWebView) { 28 | self.webview = webview 29 | super.init(nibName: nil, bundle: nil) 30 | webview.navigationDelegate = self // allows/denies navigation actions: see WebViewDelegates 31 | webview._inputDelegate = self 32 | webview._findDelegate = self 33 | 34 | if WebKit_version >= (603, 1, 17) { 35 | // STP 57, Safari 12 36 | webview._iconLoadingDelegate = self 37 | } 38 | //webview._historyDelegate = self 39 | 40 | #if DEBUG 41 | //webview._diagnosticLoggingDelegate = self 42 | #endif 43 | webview.configuration.processPool._downloadDelegate = self 44 | webview.configuration.processPool._setCanHandleHTTPSServerTrustEvaluation(true) 45 | 46 | WebViewUICallbacks.subscribe(webview) 47 | 48 | #if os(OSX) 49 | representedObject = webview // OSX omnibox/browser uses KVC to interrogate webview 50 | view.addSubview(webview, positioned: .below, relativeTo: nil) 51 | // must retain the empty parent view for the inspector to co-attach to alongside the webview 52 | #elseif os(iOS) 53 | view = webview 54 | #endif 55 | } 56 | 57 | override func viewDidLoad() { 58 | super.viewDidLoad() 59 | } 60 | 61 | @objc func askToOpenCurrentURL() { askToOpenURL(webview.url as URL?) } 62 | 63 | // sugar for delgates' opening a new tab in parent browser VC 64 | func popup(_ webview: MPWebView) -> WebViewController { 65 | let wvc = type(of: self).init(webview: webview) 66 | parent?.addChild(wvc) 67 | return wvc 68 | } 69 | 70 | @objc dynamic func focus() { warn("method not implemented by \(type(of: self))!") } 71 | @objc dynamic func dismiss() { warn("method not implemented by \(type(of: self))!") } 72 | @objc dynamic func close() { warn("method not implemented by \(type(of: self))!") } 73 | 74 | deinit { 75 | warn(description) 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /Sources/MacPinIOS/ExtsIOS.swift: -------------------------------------------------------------------------------- 1 | /// MacPin ExtsIOS 2 | /// 3 | /// Global-scope utility functions for iOS 4 | 5 | import UIKit 6 | 7 | // show an NSError to the user, attaching it to any given view 8 | func displayError(_ error: NSError, _ vc: UIViewController? = nil) { 9 | warn("`\(error.localizedDescription)` [\(error.domain)] [\(error.code)] `\(error.localizedFailureReason ?? String())` : \(error.userInfo)") 10 | let alerter = UIAlertController(title: error.localizedFailureReason, message: error.localizedDescription, preferredStyle: .alert) //.ActionSheet 11 | let OK = UIAlertAction(title: "OK", style: .default) { (_) in } 12 | alerter.addAction(OK) 13 | 14 | if let vc = vc { 15 | vc.present(alerter, animated: true, completion: nil) 16 | } else { 17 | UIApplication.shared.keyWindow?.rootViewController?.present(alerter, animated: true, completion: nil) 18 | } 19 | } 20 | 21 | func askToOpenURL(_ url: URL?) { 22 | if let url = url, UIApplication.shared.canOpenURL(url as URL) { 23 | //if { 24 | // // macpin is already the registered handler for this (probably custom) url scheme, so just open it 25 | // UIApplication.sharedApplication().openURL(url) 26 | // return 27 | //} 28 | 29 | let alerter = UIAlertController(title: "Open outside MacPin", message: url.description, preferredStyle: .alert) //.ActionSheet 30 | let OK = UIAlertAction(title: "OK", style: .default) { (_) in UIApplication.shared.openURL(url as URL) } 31 | alerter.addAction(OK) 32 | let Cancel = UIAlertAction(title: "Cancel", style: .cancel) { (_) in } 33 | alerter.addAction(Cancel) 34 | UIApplication.shared.keyWindow?.rootViewController?.present(alerter, animated: true, completion: nil) 35 | 36 | return 37 | } 38 | 39 | // all else has failed, complain to user 40 | let error = NSError(domain: "MacPin", code: 2, userInfo: [ 41 | //NSURLErrorKey: url?, 42 | NSLocalizedDescriptionKey: "No program present on this system is registered to open this non-browser URL.\n\n\(url?.description)" 43 | ]) 44 | displayError(error, nil) 45 | } 46 | -------------------------------------------------------------------------------- /Sources/MacPinIOS/shared: -------------------------------------------------------------------------------- 1 | ../MacPin -------------------------------------------------------------------------------- /Sources/MacPinOSX/EffectViewController.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | 3 | class EffectViewController: NSViewController { 4 | lazy var effectView: NSVisualEffectView = { 5 | var view = NSVisualEffectView() // https://gist.github.com/vilhalmer/3052f7e9e7f34b92a40f 6 | view.blendingMode = .behindWindow 7 | view.material = .appearanceBased //.Dark .Light .Titlebar 8 | // .fullScreenUI .contentBackground .windowBackground .underWindowBackground 9 | view.state = .active // set it to always be blurry regardless of window state 10 | view.blendingMode = .behindWindow 11 | view.frame = NSMakeRect(0, 0, 600, 800) // default size 12 | return view 13 | }() 14 | 15 | required init?(coder: NSCoder) { super.init(coder: coder) } // conform to NSCoding 16 | override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) { super.init(nibName:nil, bundle:nil) } // calls loadView() 17 | override func loadView() { view = effectView } // NIBless 18 | convenience init() { self.init(nibName: nil, bundle: nil) } 19 | 20 | override func viewDidLoad() { 21 | view.autoresizesSubviews = true 22 | view.autoresizingMask = [.width, .height, .minXMargin, .minYMargin, .maxXMargin, .maxYMargin] 23 | } 24 | 25 | // make this view intercept all hits @ sendEvent:NSEvent so we can try to shunt right-clicks to toolbar items? 26 | // https://stackoverflow.com/a/30558497/3878712 27 | } 28 | -------------------------------------------------------------------------------- /Sources/MacPinOSX/Services.swift: -------------------------------------------------------------------------------- 1 | // implement a generic router for NSService calls on OSX 2 | 3 | import AppKit 4 | 5 | // http://nshipster.com/nsdatadetector/ 6 | // https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/SysServices/Articles/providing.html#//apple_ref/doc/uid/20000853-BABDICBI 7 | // https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/SysServices/Articles/properties.html#//apple_ref/doc/uid/20000852-CHDJDFIC 8 | 9 | @objc class ServiceOSX: NSObject { 10 | 11 | //Service Specification: must set "NSMessage" = handlePboard" in sites/Blah/Services.plist to get dispatched 12 | func handlePboard(_ pboard: NSPasteboard, userData: String, error: UnsafeMutablePointer) { 13 | // should always defer to the app.js to handle the input 14 | // any error given is printed to Console/ASL 15 | warn() 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Sources/MacPinOSX/StatusBarController.swift: -------------------------------------------------------------------------------- 1 | /// MacPin StatusBarController 2 | /// 3 | /// Controls a textfield that displays a WebViewController's current hovered URL 4 | 5 | import AppKit 6 | import WebKitPrivates 7 | 8 | @objc class StatusBarField: NSTextField { // FIXMEios UILabel + UITextField 9 | override var stringValue: String { 10 | didSet { 11 | invalidateIntrinsicContentSize() 12 | sizeToFit() // shrink field to match text, like Safari 13 | isHidden = stringValue.isEmpty 14 | } 15 | } 16 | } 17 | 18 | @objc class StatusBarController: NSViewController { 19 | let statusbox = StatusBarField() 20 | 21 | 22 | @objc weak var hovered: _WKHitTestResult? = nil { 23 | didSet { 24 | if let hovered = hovered { 25 | statusbox.stringValue = hovered.absoluteLinkURL.absoluteString 26 | // Safari also seems to use SegmentedText to bold the scheme+host (origin) 27 | } else { 28 | statusbox.isHidden = true 29 | } 30 | } 31 | } 32 | 33 | required init?(coder: NSCoder) { super.init(coder: coder) } 34 | override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) { super.init(nibName:nil, bundle:nil) } // calls loadView() 35 | override func loadView() { view = statusbox } // NIBless 36 | 37 | convenience init() { 38 | self.init(nibName:nil, bundle:nil) 39 | } 40 | 41 | @objc override func viewDidLoad() { 42 | super.viewDidLoad() 43 | 44 | view.autoresizingMask = [.width] 45 | 46 | statusbox.backgroundColor = NSColor.textBackgroundColor 47 | statusbox.textColor = NSColor.labelColor 48 | statusbox.toolTip = "" 49 | 50 | if let cell = statusbox.cell as? NSTextFieldCell { 51 | cell.placeholderString = "" 52 | cell.isScrollable = false 53 | cell.target = self 54 | cell.usesSingleLineMode = true 55 | cell.focusRingType = .none 56 | cell.isEditable = false 57 | cell.isSelectable = false 58 | cell.backgroundStyle = .lowered 59 | } 60 | 61 | statusbox.isHidden = true 62 | statusbox.maximumNumberOfLines = 1 63 | 64 | statusbox.isBezeled = false 65 | // "In order to prevent inconsistent rendering, background color rendering is disabled for rounded-bezel text fields." 66 | /// seems that any .bezelStyle disables background color... 67 | statusbox.isBordered = true // in case we have more issues with text colors, at least the box will be apparent 68 | statusbox.drawsBackground = true 69 | } 70 | 71 | deinit { hovered = nil } 72 | } 73 | -------------------------------------------------------------------------------- /Sources/MacPinOSX/shared: -------------------------------------------------------------------------------- 1 | ../MacPin -------------------------------------------------------------------------------- /Sources/MacPin_static/main.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import MacPin 3 | 4 | #if os(macOS) 5 | import AppKit 6 | let app = MacPin.MacPinApp.shared 7 | print("initializing MacPinAppDelegateOSX()") 8 | let appDel = MacPin.MacPinAppDelegateOSX() 9 | app.delegate = appDel 10 | app.run() 11 | #elseif os(iOS) 12 | import UIKit 13 | print("initializing MacPinAppDelegateIOS()") 14 | UIApplicationMain( 15 | CommandLine.argc, 16 | CommandLine.unsafeArgv, 17 | NSStringFromClass(MacPinApp.self), 18 | NSStringFromClass(MacPinAppDelegateIOS.self) 19 | ) 20 | #endif 21 | -------------------------------------------------------------------------------- /Tools/iconify/null.swift: -------------------------------------------------------------------------------- 1 | // empty file to workaround https://bugs.swift.org/browse/SR-12683 2 | -------------------------------------------------------------------------------- /apple_dev_id.mk: -------------------------------------------------------------------------------- 1 | # my releases are unsigned affairs 2 | release: appsig := 3 | release: codesign := 4 | 5 | # XCode->Preferences->Accounts (add Apple ID, then create cert) 6 | # goto Keychain.app and look for ‘@keychain:Application Loader: {appleId}’ in local keychain 7 | 8 | #appsig := MacPin_hacker_Extraordinaire@example.com 9 | #mobileprov_team_id := ABC123OKOK 10 | -------------------------------------------------------------------------------- /dock_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/dock_screenshot.png -------------------------------------------------------------------------------- /modules/JavaScriptCorePrivates/JSRemoteInspector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/JSRemoteInspector.h 3 | * 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef JSRemoteInspector_h 29 | #define JSRemoteInspector_h 30 | 31 | #import 32 | #import "WebKitAvailability.h" 33 | 34 | #if defined(WIN32) || defined(_WIN32) 35 | typedef int JSProcessID; 36 | #else 37 | #import 38 | typedef pid_t JSProcessID; 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | JS_EXPORT void JSRemoteInspectorDisableAutoStart(void) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 46 | JS_EXPORT void JSRemoteInspectorStart(void) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 47 | JS_EXPORT void JSRemoteInspectorSetParentProcessInformation(JSProcessID, const uint8_t* auditData, size_t auditLength) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 48 | 49 | JS_EXPORT void JSRemoteInspectorSetLogToSystemConsole(bool) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 50 | 51 | JS_EXPORT bool JSRemoteInspectorGetInspectionEnabledByDefault(void) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 52 | JS_EXPORT void JSRemoteInspectorSetInspectionEnabledByDefault(bool) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* JSRemoteInspector_h */ 59 | -------------------------------------------------------------------------------- /modules/JavaScriptCorePrivates/WebKitAvailability.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/API/WebKitAvailability.h 3 | * 4 | * Copyright (C) 2008, 2009, 2010, 2014 Apple Inc. All Rights Reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef JSC_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED 29 | // https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/postprocess-headers.sh 30 | 31 | // http://clang.llvm.org/docs/AttributeReference.html#availability 32 | #import 33 | #import 34 | #import 35 | 36 | // Use zero since it will be less than any possible version number. 37 | #define JSC_MAC_VERSION_TBA 0 38 | #define JSC_IOS_VERSION_TBA 0 39 | #define JSC_API_AVAILABLE(...) 40 | #define JSC_CLASS_AVAILABLE(...) __attribute__((visibility("default"))) JSC_API_AVAILABLE(__VA_ARGS__) 41 | // API_AVAILABLE 42 | 43 | #endif 44 | 45 | #ifdef __OBJC__ 46 | #import 47 | 48 | #if __has_feature(assume_nonnull) 49 | 50 | #ifndef NS_ASSUME_NONNULL_BEGIN 51 | #define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") 52 | #endif 53 | 54 | #ifndef NS_ASSUME_NONNULL_END 55 | #define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") 56 | #endif 57 | 58 | #endif 59 | #endif /* __OBJC__ */ 60 | -------------------------------------------------------------------------------- /modules/JavaScriptCorePrivates/module.modulemap: -------------------------------------------------------------------------------- 1 | module JavaScriptCorePrivates { 2 | umbrella "./" 3 | 4 | link framework "JavaScriptCore" 5 | use "JavaScriptCore" 6 | } 7 | -------------------------------------------------------------------------------- /modules/Linenoise/AnsiCodes.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017, Andy Best 3 | Copyright (c) 2010-2014, Salvatore Sanfilippo 4 | Copyright (c) 2010-2013, Pieter Noordhuis 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | import Foundation 31 | 32 | public struct AnsiCodes { 33 | 34 | public static var eraseRight: String { 35 | return escapeCode("0K") 36 | } 37 | 38 | public static var homeCursor: String { 39 | return escapeCode("H") 40 | } 41 | 42 | public static var clearScreen: String { 43 | return escapeCode("2J") 44 | } 45 | 46 | public static var cursorLocation: String { 47 | return escapeCode("6n") 48 | } 49 | 50 | public static func escapeCode(_ input: String) -> String { 51 | return "\u{001B}[" + input 52 | } 53 | 54 | public static func cursorForward(_ columns: Int) -> String { 55 | return escapeCode("\(columns)C") 56 | } 57 | 58 | public static func termColor(color: Int, bold: Bool) -> String { 59 | return escapeCode("\(color);\(bold ? 1 : 0);49m") 60 | } 61 | 62 | public static func termColor256(color: Int) -> String { 63 | return escapeCode("38;5;\(color)m") 64 | } 65 | 66 | public static var origTermColor: String { 67 | return escapeCode("0m") 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /modules/Linenoise/ControlCharacters.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017, Andy Best 3 | Copyright (c) 2010-2014, Salvatore Sanfilippo 4 | Copyright (c) 2010-2013, Pieter Noordhuis 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | import Foundation 31 | 32 | internal enum ControlCharacters: UInt8 { 33 | case Null = 0 34 | case Ctrl_A = 1 35 | case Ctrl_B = 2 36 | case Ctrl_C = 3 37 | case Ctrl_D = 4 38 | case Ctrl_E = 5 39 | case Ctrl_F = 6 40 | case Bell = 7 41 | case Ctrl_H = 8 42 | case Tab = 9 43 | case Ctrl_K = 11 44 | case Ctrl_L = 12 45 | case Enter = 13 46 | case Ctrl_N = 14 47 | case Ctrl_P = 16 48 | case Ctrl_T = 20 49 | case Ctrl_U = 21 50 | case Ctrl_W = 23 51 | case Esc = 27 52 | case Backspace = 127 53 | 54 | var character: Character { 55 | return Character(UnicodeScalar(Int(self.rawValue))!) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /modules/Linenoise/Errors.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017, Andy Best 3 | Copyright (c) 2010-2014, Salvatore Sanfilippo 4 | Copyright (c) 2010-2013, Pieter Noordhuis 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | import Foundation 31 | 32 | public enum LinenoiseError: Error { 33 | case notATTY 34 | case generalError(String) 35 | case EOF 36 | case CTRL_C 37 | } 38 | -------------------------------------------------------------------------------- /modules/Linenoise/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "Linenoise", 8 | products: [ 9 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 10 | .library( 11 | name: "Linenoise", 12 | targets: ["Linenoise"]), 13 | ], 14 | dependencies: [ 15 | ], 16 | targets: [ 17 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 18 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 19 | .target( 20 | name: "Linenoise", 21 | dependencies: [], 22 | path: "./" 23 | ) 24 | ] 25 | ) 26 | -------------------------------------------------------------------------------- /modules/UTIKit/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hiroki Kato 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /modules/UTIKit/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "UTIKit", 8 | products: [ 9 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 10 | .library( 11 | name: "UTIKit", 12 | targets: ["UTIKit"]), 13 | ], 14 | dependencies: [ 15 | ], 16 | targets: [ 17 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 18 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 19 | .target( 20 | name: "UTIKit", 21 | dependencies: [], 22 | path: "./" 23 | ) 24 | ] 25 | ) 26 | -------------------------------------------------------------------------------- /modules/UTIKit/README.md: -------------------------------------------------------------------------------- 1 | # UTIKit 2 | 3 | UTIKit is an UTI (Uniform Type Identifier) wrapper for Swift. 4 | 5 | ## Features 6 | 7 | UTIKit is a full featured library including entire UTI functions. 8 | 9 | - Convertibility 10 | - Filename extension 11 | - MIME type 12 | - OSType (OS X only) 13 | - Pasteboard type (OS X only) 14 | - Equality 15 | - Conformance 16 | - and others… 17 | 18 | ## Usage 19 | 20 | ### Making from an UTI string 21 | 22 | ```swift 23 | let jpeg = UTI("public.jpeg") 24 | ``` 25 | 26 | ### Making from a filename extension 27 | 28 | ```swift 29 | let jpeg = UTI(filenameExtension: "jpeg") 30 | ``` 31 | 32 | ### Making from a MIME type 33 | 34 | ```swift 35 | let jpeg = UTI(mimeType: "image/jpeg") 36 | ``` 37 | 38 | ### Getting filename extensions or MIME types 39 | 40 | ```swift 41 | UTI(mimeType: "image/jpeg").filenameExtensions // => ["jpeg", "jpg", "jpe"] 42 | 43 | UTI(filenameExtension: "jpeg").mimeTypes // => ["image/jpeg"] 44 | ``` 45 | 46 | ### Equality 47 | 48 | ```swift 49 | UTI(mimeType: "image/jpeg") == UTI(filenameExtension: "jpeg") // => true 50 | ``` 51 | 52 | ### Conformance 53 | 54 | ```swift 55 | switch UTI(kUTTypeJPEG) { 56 | case UTI(kUTTypeImage): 57 | print("JPEG is a kind of images") 58 | default: 59 | fatalError("JPEG must be a image") 60 | } 61 | ``` 62 | 63 | ## Requirements 64 | 65 | - Swift 3.0 or later 66 | - iOS 8 or later 67 | - OS X 10.10 or later 68 | 69 | ## Author 70 | 71 | Hiroki Kato, mail@cockscomb.info 72 | 73 | ## License 74 | 75 | UTIKit is available under the MIT license. See the LICENSE file for more info. 76 | -------------------------------------------------------------------------------- /modules/UserNotificationPrivates/UserNotificationPrivates.h: -------------------------------------------------------------------------------- 1 | #import "TargetConditionals.h" 2 | 3 | #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR 4 | #else 5 | #import "NSUserNotification+Privates.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /modules/UserNotificationPrivates/module.modulemap: -------------------------------------------------------------------------------- 1 | module UserNotificationPrivates { 2 | umbrella header "UserNotificationPrivates.h" 3 | export * 4 | } 5 | -------------------------------------------------------------------------------- /modules/ViewPrivates/NSView+Privates.h: -------------------------------------------------------------------------------- 1 | @import AppKit; 2 | @interface NSView (Debug) 3 | //- (id)recursiveDescription; 4 | //- (id)_autolayoutTrace; 5 | @end 6 | -------------------------------------------------------------------------------- /modules/ViewPrivates/UIView+Privates.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | @interface UIView (Debug) 3 | - (id)recursiveDescription; 4 | - (id)_autolayoutTrace; 5 | @end 6 | 7 | @interface UIViewController (Debug) 8 | - (id)_printHierarchy; // IOS8 class meth? 9 | @end 10 | -------------------------------------------------------------------------------- /modules/ViewPrivates/ViewPrivates.h: -------------------------------------------------------------------------------- 1 | #import "TargetConditionals.h" 2 | #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_SIMULATOR 3 | #import "UIView+Privates.h" 4 | #else 5 | #import "NSView+Privates.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /modules/ViewPrivates/module.modulemap: -------------------------------------------------------------------------------- 1 | module ViewPrivates { 2 | umbrella header "ViewPrivates.h" 3 | export * 4 | } 5 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/NSTextFinderSPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebCore/PAL/pal/spi/mac/NSTextFinderSPI.h 3 | * 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | @class NSView; 30 | 31 | #if TARGET_OS_OSX 32 | typedef enum : NSUInteger { 33 | NSTextFinderAsynchronousDocumentFindOptionsBackwards = 1 << 0, 34 | NSTextFinderAsynchronousDocumentFindOptionsWrap = 1 << 1, 35 | NSTextFinderAsynchronousDocumentFindOptionsCaseInsensitive = 1 << 2, 36 | NSTextFinderAsynchronousDocumentFindOptionsStartsWith = 1 << 3, 37 | } NSTextFinderAsynchronousDocumentFindOptions; 38 | 39 | @protocol NSTextFinderAsynchronousDocumentFindMatch 40 | @required 41 | @property (retain, nonatomic, readonly) NSView *containingView; 42 | @property (retain, nonatomic, readonly) NSArray *textRects; 43 | - (void)generateTextImage:(void (^)(NSImage *))completionHandler; 44 | @end 45 | 46 | @interface NSObject () 47 | 48 | - (void)findMatchesForString:(NSString *)targetString relativeToMatch:(id )relativeMatch findOptions:(NSTextFinderAsynchronousDocumentFindOptions)findOptions maxResults:(NSUInteger)maxResults resultCollector:(void (^)(NSArray *matches, BOOL didWrap))resultCollector; 49 | - (NSView *)documentContainerView; 50 | - (void)getSelectedText:(void (^)(NSString *selectedTextString))completionHandler; 51 | - (void)selectFindMatch:(id )findMatch completionHandler:(void (^)(void))completionHandler; 52 | 53 | @end 54 | #endif 55 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKBaseMac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit2/Shared/API/c/mac/WKBaseMac.h 3 | * Copyright (C) 2013 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKBaseMac_h 28 | #define WKBaseMac_h 29 | 30 | #ifndef WKBase_h 31 | #error "Please #import \"WKBase.h\" instead of this file directly." 32 | #endif 33 | 34 | typedef const struct OpaqueWKObjCTypeWrapper* WKObjCTypeWrapperRef; 35 | 36 | #endif /* WKBaseMac_h */ 37 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKBrowsingContextHandle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/Cocoa/WKBrowsingContextHandle.h 3 | * 4 | * Copyright (C) 2013 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "./WebKitAvailability.h" 29 | 30 | WK_CLASS_AVAILABLE(macos(10.10), ios(8.0)) 31 | @interface WKBrowsingContextHandle : NSObject 32 | @end 33 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/67985c34ffc405f69995e8a35f9c38618625c403/Source/WebKit2/Shared/API/c/WKData.h 3 | * Copyright (C) 2010 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKData_h 28 | #define WKData_h 29 | 30 | #import "WKBase.h" 31 | 32 | #import 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | WK_EXPORT WKTypeID WKDataGetTypeID(); 39 | 40 | WK_EXPORT WKDataRef WKDataCreate(const unsigned char* bytes, size_t size); 41 | 42 | WK_EXPORT const unsigned char* WKDataGetBytes(WKDataRef data); 43 | WK_EXPORT size_t WKDataGetSize(WKDataRef data); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // WKData_h 50 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKDeprecated.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/WKDeprecated.h 3 | * 4 | * Copyright (C) 2018 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #ifdef _MSC_VER 31 | #define WK_C_API_DEPRECATED 32 | #define WK_C_API_DEPRECATED_WITH_REPLACEMENT(...) 33 | #else 34 | #define WK_C_API_DEPRECATED __attribute__((deprecated("No longer supported"))) 35 | #define WK_C_API_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((deprecated("use " #_replacement))) 36 | #endif 37 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/WKDictionary.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKDictionary_h 29 | #define WKDictionary_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifndef __cplusplus 34 | #import 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | WK_EXPORT WKTypeID WKDictionaryGetTypeID(void); 42 | 43 | WK_EXPORT WKDictionaryRef WKDictionaryCreate(const WKStringRef* keys, const WKTypeRef* values, size_t numberOfValues); 44 | 45 | WK_EXPORT WKTypeRef WKDictionaryGetItemForKey(WKDictionaryRef dictionary, WKStringRef key); 46 | WK_EXPORT size_t WKDictionaryGetSize(WKDictionaryRef dictionary); 47 | 48 | WK_EXPORT WKArrayRef WKDictionaryCopyKeys(WKDictionaryRef dictionary); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* WKDictionary_h */ 55 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKDragDestinationAction.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | #import 29 | 30 | typedef NS_OPTIONS(NSUInteger, WKDragDestinationAction) { 31 | WKDragDestinationActionNone = 0, 32 | WKDragDestinationActionDHTML = 1, 33 | WKDragDestinationActionEdit = 2, 34 | WKDragDestinationActionLoad = 4, 35 | WKDragDestinationActionAny = NSUIntegerMax 36 | } WK_API_AVAILABLE(macos(10.13), ios(11.0)); 37 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef WKEvent_h 27 | #define WKEvent_h 28 | 29 | #import "WKBase.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | enum { 36 | kWKEventModifiersShiftKey = 1 << 0, 37 | kWKEventModifiersControlKey = 1 << 1, 38 | kWKEventModifiersAltKey = 1 << 2, 39 | kWKEventModifiersMetaKey = 1 << 3, 40 | kWKEventModifiersCapsLockKey = 1 << 4 41 | }; 42 | typedef uint32_t WKEventModifiers; 43 | 44 | enum { 45 | kWKEventMouseButtonNoButton = -1, 46 | kWKEventMouseButtonLeftButton = 0, 47 | kWKEventMouseButtonMiddleButton = 1, 48 | kWKEventMouseButtonRightButton = 2, 49 | }; 50 | typedef int32_t WKEventMouseButton; 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* WKEvent_h */ 57 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKGeolocationPermissionRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/C/WKGeolocationPermissionRequest.h 3 | * 4 | * Copyright (C) 2011 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKGeolocationPermissionRequest_h 29 | #define WKGeolocationPermissionRequest_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | WK_EXPORT WKTypeID WKGeolocationPermissionRequestGetTypeID(); 38 | 39 | WK_EXPORT void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequest); 40 | WK_EXPORT void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequest); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* WKGeolocationPermissionRequest_h */ 47 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKGeolocationPosition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.h 3 | * 4 | * Copyright (C) 2011 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKGeolocationPosition_h 29 | #define WKGeolocationPosition_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | WK_EXPORT WKTypeID WKGeolocationPositionGetTypeID(); 38 | 39 | WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy); 40 | WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); 41 | WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate_c(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* WKGeolocationPosition_h */ 48 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKHistoryDelegatePrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKHistoryDelegatePrivate.h 4 | * 5 | * Copyright (C) 2014 Apple Inc. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | * THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #import 30 | 31 | #import 32 | 33 | @class WKNavigationData; 34 | @class WKWebView; 35 | 36 | @protocol WKHistoryDelegatePrivate 37 | 38 | @optional 39 | 40 | - (void)_webView:(WKWebView *)webView didNavigateWithNavigationData:(WKNavigationData *)navigationData; 41 | - (void)_webView:(WKWebView *)webView didPerformClientRedirectFromURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL; 42 | - (void)_webView:(WKWebView *)webView didPerformServerRedirectFromURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL; 43 | - (void)_webView:(WKWebView *)webView didUpdateHistoryTitle:(NSString *)title forURL:(NSURL *)URL; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKInspector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/C/WKInspector.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKInspector_h 29 | #define WKInspector_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifndef __cplusplus 34 | #import 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | WK_EXPORT WKTypeID WKInspectorGetTypeID(); 42 | 43 | WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector); 44 | 45 | WK_EXPORT bool WKInspectorIsConnected(WKInspectorRef inspector); 46 | WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector); 47 | WK_EXPORT bool WKInspectorIsFront(WKInspectorRef inspector); 48 | 49 | WK_EXPORT void WKInspectorConnect(WKInspectorRef inspector); 50 | 51 | WK_EXPORT void WKInspectorShow(WKInspectorRef inspector); 52 | WK_EXPORT void WKInspectorHide(WKInspectorRef inspector); 53 | WK_EXPORT void WKInspectorClose(WKInspectorRef inspector); 54 | 55 | WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector); 56 | WK_EXPORT void WKInspectorShowResources(WKInspectorRef inspector); 57 | WK_EXPORT void WKInspectorShowMainResourceForFrame(WKInspectorRef inspector, WKFrameRef frame); 58 | 59 | WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector); 60 | WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector); 61 | WK_EXPORT void WKInspectorDetach(WKInspectorRef inspector); 62 | 63 | WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector); 64 | WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif // WKInspector_h 71 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKInspectorPrivateMac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/C/mac/WKInspectorPrivateMac.h 3 | * 4 | * Copyright (C) 2011 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #if !TARGET_OS_IPHONE 31 | 32 | #import 33 | #import "WKDeclarationSpecifiers.h" 34 | #import "WKInspector.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | const NSInteger WKInspectorViewTag = 1000; 41 | 42 | // This class is the Web Inspector window delegate. It can be used to add interface 43 | // actions that need to work when the Web Inspector window is key. 44 | WK_EXPORT @interface WKWebInspectorProxyObjCAdapter : NSObject { 45 | void* _inspectorProxy; 46 | } 47 | 48 | @property (readonly) WKInspectorRef inspectorRef; 49 | 50 | @end 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKMutableDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/WKMutableDictionary.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKMutableDictionary_h 29 | #define WKMutableDictionary_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifndef __cplusplus 34 | #import 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | NS_ASSUME_NONNULL_BEGIN 42 | 43 | WK_EXPORT WKMutableDictionaryRef WKMutableDictionaryCreate(); 44 | 45 | WK_EXPORT bool WKDictionarySetItem(WKMutableDictionaryRef dictionary, WKStringRef key, WKTypeRef item); 46 | 47 | NS_ASSUME_NONNULL_END 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* WKMutableDictionary_h */ 54 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNativeEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef WKNativeEvent_h 27 | #define WKNativeEvent_h 28 | 29 | #ifdef __APPLE__ 30 | #import 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #if defined(__APPLE__) && !TARGET_OS_IPHONE && !defined(BUILDING_GTK__) 38 | #ifdef __OBJC__ 39 | @class NSEvent; 40 | #elif __cplusplus 41 | class NSEvent; 42 | #else 43 | struct NSEvent; 44 | #endif 45 | typedef NSEvent *WKNativeEventPtr; 46 | #elif defined(BUILDING_GTK__) 47 | typedef union _GdkEvent GdkEvent; 48 | typedef const GdkEvent* WKNativeEventPtr; 49 | #else 50 | typedef const void* WKNativeEventPtr; 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* WKNativeEvent_h */ 58 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNavigationActionPrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | //@class _WKUserInitiatedAction; 29 | 30 | #if TARGET_OS_IPHONE 31 | //@class CGPoint; 32 | typedef NS_ENUM(NSInteger, WKSyntheticClickType) { 33 | WKSyntheticClickTypeNoTap, 34 | WKSyntheticClickTypeOneFingerTap, 35 | WKSyntheticClickTypeTwoFingerTap 36 | } WK_API_AVAILABLE(ios(10.0)); 37 | #endif 38 | 39 | @interface WKNavigationAction (WKPrivate) 40 | 41 | @property (nonatomic, readonly) NSURL *_originalURL; 42 | @property (nonatomic, readonly, getter=_isUserInitiated) BOOL _userInitiated; 43 | @property (nonatomic, readonly) BOOL _canHandleRequest; 44 | @property (nonatomic, readonly) BOOL _shouldOpenExternalSchemes WK_API_AVAILABLE(macos(10.11), ios(9.0)); 45 | @property (nonatomic, readonly) BOOL _shouldOpenAppLinks WK_API_AVAILABLE(macos(10.11), ios(9.0)); 46 | 47 | @property (nonatomic, readonly) BOOL _shouldOpenExternalURLs WK_API_DEPRECATED("use _shouldOpenExternalSchemes and _shouldOpenAppLinks", macos(10.11, 10.11), ios(9.0, 9.0)); 48 | 49 | //@property (nonatomic, readonly) _WKUserInitiatedAction *_userInitiatedAction WK_API_AVAILABLE(macos(10.12), ios(10.0)); 50 | 51 | #if TARGET_OS_IPHONE 52 | @property (nonatomic, readonly) WKSyntheticClickType _syntheticClickType WK_API_AVAILABLE(ios(10.0)); 53 | //@property (nonatomic, readonly) CGPoint _clickLocationInRootViewCoordinates WK_API_AVAILABLE(ios(11.0)); 54 | #endif 55 | 56 | @property (nonatomic, readonly) BOOL _isRedirect WK_API_AVAILABLE(macos(10.13), ios(11.0)); 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNavigationResponsePrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/ce24e8d887968296a2acebd96c31797d36fb08ca/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationResponsePrivate.h 3 | * Copyright (C) 2014 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #import 28 | 29 | @interface WKNavigationResponse (WKPrivate) 30 | 31 | @property (nonatomic, readonly) WKFrameInfo *_frame; 32 | @property (nonatomic, readonly) NSURLRequest *_request; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef WKNotification_h 27 | #define WKNotification_h 28 | 29 | #import "WKBase.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | WK_EXPORT WKTypeID WKNotificationGetTypeID(); 36 | 37 | WK_EXPORT WKStringRef WKNotificationCopyTitle(WKNotificationRef notification); 38 | WK_EXPORT WKStringRef WKNotificationCopyBody(WKNotificationRef notification); 39 | WK_EXPORT WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification); 40 | WK_EXPORT WKStringRef WKNotificationCopyTag(WKNotificationRef notification); 41 | WK_EXPORT WKStringRef WKNotificationCopyLang(WKNotificationRef notification); 42 | WK_EXPORT WKStringRef WKNotificationCopyDir(WKNotificationRef notification); 43 | WK_EXPORT WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification); 44 | WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif // WKNotification_h 51 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNotificationManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef WKNotificationManager_h 27 | #define WKNotificationManager_h 28 | 29 | #import "WKNotificationProvider.h" 30 | #import "WKBase.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | WK_EXPORT WKTypeID WKNotificationManagerGetTypeID(); 37 | WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProviderBase* wkProvider); 38 | 39 | WK_EXPORT void WKNotificationManagerProviderDidShowNotification(WKNotificationManagerRef managerRef, uint64_t notificationID); 40 | WK_EXPORT void WKNotificationManagerProviderDidClickNotification(WKNotificationManagerRef managerRef, uint64_t notificationID); 41 | WK_EXPORT void WKNotificationManagerProviderDidCloseNotifications(WKNotificationManagerRef managerRef, WKArrayRef notificationIDs); 42 | WK_EXPORT void WKNotificationManagerProviderDidUpdateNotificationPolicy(WKNotificationManagerRef managerRef, WKSecurityOriginRef origin, bool allowed); 43 | WK_EXPORT void WKNotificationManagerProviderDidRemoveNotificationPolicies(WKNotificationManagerRef managerRef, WKArrayRef origins); 44 | WK_EXPORT uint64_t WKNotificationManagerGetLocalIDForTesting(WKNotificationManagerRef managerRef, WKNotificationRef notification); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif // WKNotificationManager_h 51 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNotificationPermissionRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef WKNotificationPermissionRequest_h 27 | #define WKNotificationPermissionRequest_h 28 | 29 | #import "WKBase.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | WK_EXPORT WKTypeID WKNotificationPermissionRequestGetTypeID(); 36 | 37 | WK_EXPORT void WKNotificationPermissionRequestAllow(WKNotificationPermissionRequestRef notificationPermissionRequest); 38 | WK_EXPORT void WKNotificationPermissionRequestDeny(WKNotificationPermissionRequestRef notificationPermissionRequest); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif // WKNotificationPermissionRequest_h 45 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKNumber.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/WKNumber.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKNumber_h 29 | #define WKNumber_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* WKBoolean */ 38 | WK_EXPORT WKTypeID WKBooleanGetTypeID(void); 39 | WK_EXPORT WKBooleanRef WKBooleanCreate(bool value); 40 | WK_EXPORT bool WKBooleanGetValue(WKBooleanRef booleanRef); 41 | 42 | /* WKDouble */ 43 | WK_EXPORT WKTypeID WKDoubleGetTypeID(void); 44 | WK_EXPORT WKDoubleRef WKDoubleCreate(double value); 45 | WK_EXPORT double WKDoubleGetValue(WKDoubleRef doubleRef); 46 | 47 | /* WKUInt64 */ 48 | WK_EXPORT WKTypeID WKUInt64GetTypeID(void); 49 | WK_EXPORT WKUInt64Ref WKUInt64Create(uint64_t value); 50 | WK_EXPORT uint64_t WKUInt64GetValue(WKUInt64Ref integerRef); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* WKNumber_h */ 57 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/Cocoa/WKObject.h 3 | * 4 | * Copyright (C) 2013 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #ifdef __cplusplus 31 | #import 32 | 33 | namespace API { 34 | class Object; 35 | 36 | template 37 | struct ObjectStorage { 38 | T* get() { return reinterpret_cast(&data); } 39 | T& operator*() { return *reinterpret_cast(&data); } 40 | T* operator->() { return reinterpret_cast(&data); } 41 | 42 | typename std::aligned_storage::value>::type data; 43 | }; 44 | 45 | API::Object* unwrap(void*); 46 | void* wrap(API::Object*); 47 | 48 | } 49 | 50 | @protocol WKObject 51 | 52 | @property (readonly) API::Object& _apiObject; 53 | 54 | @end 55 | 56 | @interface WKObject : NSObject 57 | 58 | - (NSObject *)_web_createTarget NS_RETURNS_RETAINED; 59 | 60 | @end 61 | 62 | #endif // __cplus 63 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKOpenPanelParameters.h: -------------------------------------------------------------------------------- 1 | #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200 2 | // 10.12+ SDKs already ship this header, so don't redefine unless building with an old one 3 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.h 4 | 5 | /* 6 | * Copyright (C) 2016 Apple Inc. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 19 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 | * THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | #import 30 | 31 | #if !TARGET_OS_IPHONE 32 | 33 | #import 34 | 35 | NS_ASSUME_NONNULL_BEGIN 36 | 37 | /*! WKOpenPanelParameters contains parameters that a file upload control has specified. 38 | */ 39 | WK_CLASS_AVAILABLE(macos(10.12)) 40 | @interface WKOpenPanelParameters : NSObject 41 | 42 | /*! @abstract Whether the file upload control supports multiple files. 43 | */ 44 | @property (nonatomic, readonly) BOOL allowsMultipleSelection; 45 | 46 | /*! @abstract Whether the file upload control supports selecting directories. 47 | */ 48 | @property (nonatomic, readonly) BOOL allowsDirectories WK_API_AVAILABLE(macos(10.13.4)); 49 | 50 | NS_ASSUME_NONNULL_END 51 | 52 | @end 53 | 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKReloadFrameErrorRecoveryAttempter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.h 4 | * 5 | * Copyright (C) 2014 Apple Inc. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | * THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #import 30 | #import 31 | // https://github.com/WebKit/webkit/blob/main/Source/WTF/wtf/Forward.h 32 | // https://github.com/WebKit/webkit/blob/main/Source/WTF/wtf/text/CString.h 33 | 34 | @class WKWebView; 35 | @class _WKFrameHandle; 36 | 37 | @interface WKReloadFrameErrorRecoveryAttempter : NSObject 38 | 39 | - (id)initWithWebView:(WKWebView *)webView frameHandle:(_WKFrameHandle *)frameHandle urlString:(const String&)urlString; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKSecurityOriginRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/WKSecurityOriginRef.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKSecurityOriginRef_h 29 | #define WKSecurityOriginRef_h 30 | 31 | #import "WKBase.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | WK_EXPORT WKTypeID WKSecurityOriginGetTypeID(); 38 | 39 | WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromString(WKStringRef string); 40 | WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromDatabaseIdentifier(WKStringRef identifier); 41 | WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreate(WKStringRef protocol, WKStringRef host, int port); 42 | 43 | WK_EXPORT WKStringRef WKSecurityOriginCopyDatabaseIdentifier(WKSecurityOriginRef securityOrigin); 44 | WK_EXPORT WKStringRef WKSecurityOriginCopyToString(WKSecurityOriginRef securityOrigin); 45 | WK_EXPORT WKStringRef WKSecurityOriginCopyProtocol(WKSecurityOriginRef securityOrigin); 46 | WK_EXPORT WKStringRef WKSecurityOriginCopyHost(WKSecurityOriginRef securityOrigin); 47 | WK_EXPORT unsigned short WKSecurityOriginGetPort(WKSecurityOriginRef securityOrigin); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* WKSecurityOriginRef_h */ 54 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/67985c34ffc405f69995e8a35f9c38618625c403/Source/WebKit2/Shared/API/c/WKString.h 3 | * Copyright (C) 2010 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKString_h 28 | #define WKString_h 29 | 30 | #import "WKBase.h" 31 | #import 32 | 33 | #ifndef __cplusplus 34 | #import 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #if !defined(WIN32) && !defined(_WIN32) \ 42 | && !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */ 43 | typedef unsigned short WKChar; 44 | #else 45 | typedef wchar_t WKChar; 46 | #endif 47 | 48 | WK_EXPORT WKTypeID WKStringGetTypeID(); 49 | 50 | WK_EXPORT WKStringRef WKStringCreateWithUTF8CString(const char* string); 51 | 52 | WK_EXPORT bool WKStringIsEmpty(WKStringRef string); 53 | 54 | WK_EXPORT size_t WKStringGetLength(WKStringRef string); 55 | WK_EXPORT size_t WKStringGetCharacters(WKStringRef string, WKChar* buffer, size_t bufferLength); 56 | 57 | WK_EXPORT size_t WKStringGetMaximumUTF8CStringSize(WKStringRef string); 58 | WK_EXPORT size_t WKStringGetUTF8CString(WKStringRef string, char* buffer, size_t bufferSize); 59 | 60 | WK_EXPORT bool WKStringIsEqual(WKStringRef a, WKStringRef b); 61 | WK_EXPORT bool WKStringIsEqualToUTF8CString(WKStringRef a, const char* b); 62 | WK_EXPORT bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef a, const char* b); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* WKString_h */ 69 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKStringCF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/c/cf/WKStringCF.h 3 | * 4 | * Copyright (C) 2010 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WKStringCF_h 29 | #define WKStringCF_h 30 | 31 | #import 32 | #import "WKBase.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | WK_EXPORT WKStringRef WKStringCreateWithCFString(CFStringRef string); 39 | WK_EXPORT CFStringRef WKStringCopyCFString(CFAllocatorRef alloc, WKStringRef string) CF_RETURNS_RETAINED; 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* WKStringCF_h */ 46 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit2/Shared/API/c/WKType.h 3 | * Copyright (C) 2010 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKType_h 28 | #define WKType_h 29 | 30 | #import "WKBase.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | WK_EXPORT WKTypeID WKGetTypeID(WKTypeRef type); 37 | 38 | WK_EXPORT WKTypeRef WKRetain(WKTypeRef type); 39 | WK_EXPORT void WKRelease(WKTypeRef type); 40 | 41 | /* https://lists.webkit.org/pipermail/webkit-help/2011-March/002000.html 42 | >> All WK*Ref types are ref-counted. WKRetain and WKRelease work on any WK*Ref type. WebKit2's C API is modeled after CoreFoundation. You can find more information (including information about memory management) here: 43 | https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFDesignConcepts/CFDesignConcepts.html#//apple_ref/doc/uid/10000122 44 | 45 | https://lists.webkit.org/pipermail/webkit-help/2010-April/000956.html 46 | Uses of CF/JS/WKRetain and Release should follow the "Create Rule" - if you used a Create() function, you are the owner (by default) and will need to release it later. 47 | https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029 48 | 49 | */ 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* WKType_h */ 56 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKURL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/67985c34ffc405f69995e8a35f9c38618625c403/Source/WebKit2/Shared/API/c/WKURL.h 3 | * Copyright (C) 2010 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKURL_h 28 | #define WKURL_h 29 | 30 | #import "WKBase.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | WK_EXPORT WKTypeID WKURLGetTypeID(); 37 | 38 | WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string); 39 | WK_EXPORT WKURLRef WKURLCreateWithBaseURL(WKURLRef baseURL, const char* relative); 40 | 41 | WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url); 42 | WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url); 43 | WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url); 44 | WK_EXPORT WKStringRef WKURLCopyPath(WKURLRef url); 45 | WK_EXPORT WKStringRef WKURLCopyLastPathComponent(WKURLRef url); 46 | 47 | WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* WKURL_h */ 54 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKURLCF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/67985c34ffc405f69995e8a35f9c38618625c403/Source/WebKit2/Shared/API/c/cf/WKURLCF.h 3 | * Copyright (C) 2010 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WKURLCF_h 28 | #define WKURLCF_h 29 | 30 | #import 31 | #import "WKBase.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | WK_EXPORT WKURLRef WKURLCreateWithCFURL(CFURLRef URL); 38 | WK_EXPORT CFURLRef WKURLCopyCFURL(CFAllocatorRef alloc, WKURLRef URL) CF_RETURNS_RETAINED; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* WKURLCF_h */ 45 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/WKView+Privates.h: -------------------------------------------------------------------------------- 1 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKView.h 2 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h 3 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/mac/WKViewInternal.h 4 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/mac/WKView.mm 5 | 6 | @import WebKit; 7 | #import "WKBase.h" 8 | 9 | #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR 10 | @interface WKView : UIView { 11 | #else 12 | WK_CLASS_DEPRECATED_WITH_REPLACEMENT("WKWebView", macos(10.10, 10.14.4), ios(8.0, 12.2)) 13 | @interface WKView : NSView { 14 | #endif 15 | } 16 | @property BOOL drawsBackground; 17 | @property BOOL drawsTransparentBackground; 18 | @end 19 | 20 | @interface WKView (Private) 21 | @property (readonly) WKPageRef pageRef; 22 | 23 | #if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR 24 | @property (readwrite) NSSize minimumSizeForAutoLayout; 25 | @property (readwrite) BOOL shouldClipToVisibleRect; 26 | @property (readwrite) BOOL shouldExpandToViewHeightForAutoLayout; 27 | 28 | @property (nonatomic, setter=_setViewScale:) CGFloat _viewScale; 29 | 30 | @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_API_AVAILABLE(macos(10.11)); 31 | 32 | @property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets; 33 | 34 | @property (readonly) NSColor *_pageExtendedBackgroundColor; 35 | @property (copy, nonatomic) NSColor *underlayColor; 36 | 37 | @property (nonatomic, setter=_setBackgroundColor:) NSColor *_backgroundColor WK_API_AVAILABLE(macos(10.14)); 38 | 39 | // https://github.com/WebKit/webkit/commit/eea322e40e200c93030702aa0a6524d249e9795f 40 | @property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_API_AVAILABLE(macos(10.11)); 41 | 42 | // https://github.com/WebKit/webkit/blob/72b18a0525ffb78247aa1951efc17129f8390f37/Source/WebKit2/UIProcess/API/mac/WKView.mm#L2312 43 | - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef; 44 | - (NSDragOperation)draggingEntered:(id )draggingInfo; 45 | - (NSDragOperation)draggingUpdated:(id )draggingInfo; 46 | - (void)draggingExited:(id )draggingInfo; 47 | - (BOOL)prepareForDragOperation:(id )draggingInfo; 48 | - (BOOL)performDragOperation:(id )draggingInfo; 49 | #endif 50 | @end 51 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKActivatedElementInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #if TARGET_OS_IPHONE 31 | @class UIImage; 32 | #else 33 | @class NSImage; 34 | #endif 35 | 36 | typedef NS_ENUM(NSInteger, _WKActivatedElementType) { 37 | _WKActivatedElementTypeLink, 38 | _WKActivatedElementTypeImage, 39 | _WKActivatedElementTypeAttachment WK_API_AVAILABLE(macos(10.12), ios(10.0)), 40 | _WKActivatedElementTypeUnspecified WK_API_AVAILABLE(macos(10.13), ios(11.0)), 41 | } WK_API_AVAILABLE(macos(10.10), ios(8.0)); 42 | 43 | WK_CLASS_AVAILABLE(macos(10.10), ios(8.0)) 44 | @interface _WKActivatedElementInfo : NSObject 45 | 46 | @property (nonatomic, readonly) NSURL *URL; 47 | @property (nonatomic, readonly) NSURL *imageURL; 48 | @property (nonatomic, readonly) NSString *title; 49 | @property (nonatomic, readonly) _WKActivatedElementType type; 50 | @property (nonatomic, readonly) CGRect boundingRect; 51 | @property (nonatomic, readonly) NSString *ID WK_API_AVAILABLE(macos(10.12), ios(10.0)); 52 | @property (nonatomic, readonly) BOOL isAnimatedImage WK_API_AVAILABLE(macos(10.15), ios(13.0)); 53 | #if TARGET_OS_IPHONE 54 | @property (nonatomic, readonly) NSDictionary *userInfo WK_API_AVAILABLE(ios(11.0)); 55 | @property (nonatomic, readonly, copy) UIImage *image; 56 | #else 57 | @property (nonatomic, readonly, copy) NSImage *image; 58 | #endif 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKApplicationManifest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | typedef NS_ENUM(NSInteger, _WKApplicationManifestDisplayMode) { 33 | _WKApplicationManifestDisplayModeBrowser, 34 | _WKApplicationManifestDisplayModeMinimalUI, 35 | _WKApplicationManifestDisplayModeStandalone, 36 | _WKApplicationManifestDisplayModeFullScreen, 37 | } WK_API_AVAILABLE(macos(10.13.4), ios(11.3)); 38 | 39 | WK_CLASS_AVAILABLE(macos(10.13.4), ios(11.3)) 40 | @interface _WKApplicationManifest : NSObject 41 | 42 | @property (nonatomic, readonly, nullable, copy) NSString *name; 43 | @property (nonatomic, readonly, nullable, copy) NSString *shortName; 44 | @property (nonatomic, readonly, nullable, copy) NSString *applicationDescription; 45 | @property (nonatomic, readonly, nullable, copy) NSURL *scope; 46 | @property (nonatomic, readonly, copy) NSURL *startURL; 47 | @property (nonatomic, readonly) _WKApplicationManifestDisplayMode displayMode; 48 | 49 | + (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(nullable NSURL *)manifestURL documentURL:(nullable NSURL *)documentURL; 50 | 51 | @end 52 | 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKDiagnosticLoggingDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h 3 | * 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #import 31 | 32 | typedef NS_ENUM(NSInteger, _WKDiagnosticLoggingResultType) { 33 | _WKDiagnosticLoggingResultPass, 34 | _WKDiagnosticLoggingResultFail, 35 | _WKDiagnosticLoggingResultNoop, 36 | } WK_API_AVAILABLE(macos(10.11), ios(9.0)); 37 | 38 | @class WKWebView; 39 | 40 | @protocol _WKDiagnosticLoggingDelegate 41 | @optional 42 | 43 | - (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description; 44 | - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithResult:(NSString *)message description:(NSString *)description result:(_WKDiagnosticLoggingResultType)result; 45 | - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithValue:(NSString *)message description:(NSString *)description value:(NSString *) value; 46 | - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithEnhancedPrivacy:(NSString *)message description:(NSString *)description WK_API_AVAILABLE(macos(10.13), ios(11.0)); 47 | - (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description valueDictionary:(NSDictionary *)valueDictionary WK_API_AVAILABLE(macos(10.15), ios(13.0)); 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKDownload.h: -------------------------------------------------------------------------------- 1 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit2/UIProcess/API/Cocoa/_WKDownload.h 2 | @import WebKit; 3 | /* 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | @class WKWebView; 29 | 30 | WK_CLASS_AVAILABLE(macos(10.10), ios(8.0)) 31 | @interface _WKDownload : NSObject 32 | 33 | - (void)cancel; 34 | 35 | @property (nonatomic, readonly) NSURLRequest *request; 36 | @property (nonatomic, readonly, weak) WKWebView *originatingWebView; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKDownloadDelegate.h: -------------------------------------------------------------------------------- 1 | // https://github.com/WebKit/webkit/blob/main/Source/WebKit2/UIProcess/API/Cocoa/_WKDownloadDelegate.h 2 | @import WebKit; 3 | /* 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | @class _WKDownload; 31 | 32 | @protocol _WKDownloadDelegate 33 | @optional 34 | - (void)_downloadDidStart:(_WKDownload *)download; 35 | - (void)_download:(_WKDownload *)download didReceiveResponse:(NSURLResponse *)response; 36 | - (void)_download:(_WKDownload *)download didReceiveData:(uint64_t)length; 37 | - (NSString *)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename allowOverwrite:(BOOL *)allowOverwrite; 38 | - (void)_downloadDidFinish:(_WKDownload *)download; 39 | - (void)_download:(_WKDownload *)download didFailWithError:(NSError *)error; 40 | - (void)_downloadDidCancel:(_WKDownload *)download; 41 | @end 42 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKErrorRecoveryAttempting.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKErrorRecoveryAttempting.h 4 | * 5 | * Copyright (C) 2014 Apple Inc. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | * THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #import 30 | #import 31 | #import "WKDeclarationSpecifiers.h" 32 | 33 | WK_EXPORT extern NSString * const _WKRecoveryAttempterErrorKey; 34 | 35 | @protocol _WKErrorRecoveryAttempting 36 | 37 | - (BOOL)attemptRecovery; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKFindDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKFindDelegate.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | 31 | #import 32 | 33 | @protocol _WKFindDelegate 34 | 35 | @optional 36 | 37 | - (void)_webView:(WKWebView *)webView didCountMatches:(NSUInteger)matches forString:(NSString *)string; 38 | - (void)_webView:(WKWebView *)webView didFindMatches:(NSUInteger)matches forString:(NSString *)string withMatchIndex:(NSInteger)matchIndex; 39 | - (void)_webView:(WKWebView *)webView didFailToFindString:(NSString *)string; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKFindOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKFindOptions.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | typedef NS_OPTIONS(NSUInteger, _WKFindOptions) { 31 | _WKFindOptionsCaseInsensitive = 1 << 0, 32 | _WKFindOptionsAtWordStarts = 1 << 1, 33 | _WKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2, 34 | _WKFindOptionsBackwards = 1 << 3, 35 | _WKFindOptionsWrapAround = 1 << 4, 36 | _WKFindOptionsShowOverlay = 1 << 5, 37 | _WKFindOptionsShowFindIndicator = 1 << 6, 38 | _WKFindOptionsShowHighlight = 1 << 7, 39 | _WKFindOptionsDetermineMatchIndex = 1 << 8, 40 | 41 | _WKFindOptionsIrrelevantForIncrementalResults = _WKFindOptionsShowOverlay | _WKFindOptionsShowFindIndicator | _WKFindOptionsShowHighlight | _WKFindOptionsDetermineMatchIndex, 42 | _WKFindOptionsIrrelevantForBatchResults = _WKFindOptionsBackwards | _WKFindOptionsWrapAround | _WKFindOptionsIrrelevantForIncrementalResults 43 | 44 | } WK_API_AVAILABLE(macos(10.10), ios(8.0)); 45 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKFormInputSession.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKFormInputSession.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | #import "_WKFocusedElementInfo.h" 31 | 32 | @protocol _WKFormInputSession 33 | 34 | @property (nonatomic, readonly, getter=isValid) BOOL valid; 35 | @property (nonatomic, readonly) NSObject *userObject; 36 | @property (nonatomic, readonly) id <_WKFocusedElementInfo> focusedElementInfo WK_API_AVAILABLE(macos(10.12), ios(10.0)); 37 | 38 | #if TARGET_OS_IPHONE 39 | @property (nonatomic, copy) NSString *accessoryViewCustomButtonTitle; 40 | @property (nonatomic, strong) UIView *customInputView WK_API_AVAILABLE(ios(10.0)); 41 | #endif 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKHitTestResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/Cocoa/_WKHitTestResult.h 3 | * 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | 31 | // https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html#//apple_ref/doc/uid/20002378-106633-CJBGFCAC 32 | //you're the weakest link... goodbye! 33 | // `nm build//macosx-x86_64-apple-macosx10.11/exec/MacPin | grep _OBJC_CLASS_\$__WK` still sez its there 34 | 35 | WK_CLASS_AVAILABLE(macos(10.12)) 36 | __attribute__((weak_import)) 37 | @interface _WKHitTestResult : NSObject 38 | 39 | @property (nonatomic, readonly, copy) NSURL *absoluteImageURL; 40 | @property (nonatomic, readonly, copy) NSURL *absolutePDFURL; 41 | @property (nonatomic, readonly, copy) NSURL *absoluteLinkURL; 42 | @property (nonatomic, readonly, copy) NSURL *absoluteMediaURL; 43 | 44 | @property (nonatomic, readonly, copy) NSString *linkLabel; 45 | @property (nonatomic, readonly, copy) NSString *linkTitle; 46 | @property (nonatomic, readonly, copy) NSString *lookupText; 47 | 48 | @property (nonatomic, readonly, getter=isContentEditable) BOOL contentEditable; 49 | 50 | @property (nonatomic, readonly) CGRect elementBoundingBox; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKIconLoadingDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKIconLoadingDelegate.h 3 | * 4 | * Copyright (C) 2016 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class _WKLinkIconParameters; 33 | 34 | @protocol _WKIconLoadingDelegate 35 | @optional 36 | 37 | - (void)webView:(WKWebView *)webView shouldLoadIconWithParameters:(_WKLinkIconParameters *)parameters completionHandler:(void (^)(void (^)(NSData*)))completionHandler; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKInputDelegate.h: -------------------------------------------------------------------------------- 1 | /* https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h 2 | * Copyright (C) 2015 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | #import 28 | 29 | @class WKWebView; 30 | @protocol _WKFocusedElementInfo; 31 | @protocol _WKFormInputSession; 32 | 33 | @protocol _WKInputDelegate 34 | 35 | @optional 36 | 37 | - (void)_webView:(WKWebView *)webView didStartInputSession:(id <_WKFormInputSession>)inputSession; 38 | - (void)_webView:(WKWebView *)webView willSubmitFormValues:(NSDictionary *)values userObject:(NSObject *)userObject submissionHandler:(void (^)(void))submissionHandler; 39 | 40 | #if TARGET_OS_IPHONE 41 | - (BOOL)_webView:(WKWebView *)webView focusShouldStartInputSession:(id <_WKFocusedElementInfo>)info; 42 | - (void)_webView:(WKWebView *)webView accessoryViewCustomButtonTappedInFormInputSession:(id <_WKFormInputSession>)inputSession; 43 | - (BOOL)_webView:(WKWebView *)webView hasSuggestionsForCurrentStringInInputSession:(id <_WKFormInputSession>)inputSession; 44 | - (NSArray *)_webView:(WKWebView *)webView suggestionsForString:(NSString *)string inInputSession:(id <_WKFormInputSession>)inputSession; 45 | #endif 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKInspector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h 3 | * 4 | * Copyright (C) 2018 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | 31 | @class WKWebView; 32 | @class _WKFrameHandle; 33 | 34 | NS_ASSUME_NONNULL_BEGIN 35 | 36 | WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 37 | @interface _WKInspector : NSObject 38 | 39 | - (instancetype)init NS_UNAVAILABLE; 40 | 41 | @property (nonatomic, readonly) WKWebView *webView; 42 | @property (nonatomic, readonly) BOOL isConnected; 43 | @property (nonatomic, readonly) BOOL isVisible; 44 | @property (nonatomic, readonly) BOOL isFront; 45 | @property (nonatomic, readonly) BOOL isProfilingPage; 46 | @property (nonatomic, readonly) BOOL isElementSelectionActive; 47 | 48 | - (void)connect; 49 | - (void)show; 50 | - (void)hide; 51 | - (void)close; 52 | - (void)showConsole; 53 | - (void)showResources; 54 | - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 55 | - (void)attach; 56 | - (void)detach; 57 | - (void)togglePageProfiling; 58 | - (void)toggleElementSelection; 59 | - (void)printErrorToConsole:(NSString *)error; 60 | 61 | @end 62 | 63 | NS_ASSUME_NONNULL_END 64 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKLayoutMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKLayoutMode.h 3 | * Copyright (C) 2015 Apple Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #import 28 | 29 | typedef NS_ENUM(NSUInteger, _WKLayoutMode) { 30 | _WKLayoutModeViewSize = 0, 31 | _WKLayoutModeFixedSize = 1, 32 | 33 | // Lay out the view with its frame scaled by the inverse viewScale. 34 | _WKLayoutModeDynamicSizeComputedFromViewScale = 2, 35 | 36 | // Lay out the view at a heuristically-determined size based on the minimum size of the document. 37 | _WKLayoutModeDynamicSizeComputedFromMinimumDocumentSize = 4, 38 | 39 | } WK_API_AVAILABLE(macos(10.11), ios(9.0)); 40 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKLinkIconParameters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Apple Inc. All rights reserved. 3 | * 4 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKLinkIconParameters.h 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #import 31 | 32 | typedef NS_ENUM(NSInteger, WKLinkIconType) { 33 | WKLinkIconTypeFavicon, 34 | WKLinkIconTypeTouchIcon, 35 | WKLinkIconTypeTouchPrecomposedIcon, 36 | } WK_API_AVAILABLE(macos(10.12.3), ios(10.3)); 37 | 38 | WK_CLASS_AVAILABLE(macos(10.12.3), ios(10.3)) 39 | @interface _WKLinkIconParameters : NSObject 40 | 41 | @property (nonatomic, readonly, copy) NSURL *url; 42 | @property (nonatomic, readonly) WKLinkIconType iconType; 43 | @property (nonatomic, readonly, copy) NSString *mimeType; 44 | @property (nonatomic, readonly, copy) NSNumber *size; 45 | 46 | @property (nonatomic, readonly, copy) NSDictionary *attributes WK_API_AVAILABLE(macos(10.14), ios(12.0)); 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKRenderingProgressEvents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/Shared/API/Cocoa/_WKRenderingProgressEvents.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | typedef NS_OPTIONS(NSUInteger, _WKRenderingProgressEvents) { 31 | _WKRenderingProgressEventFirstLayout = 1 << 0, 32 | _WKRenderingProgressEventFirstVisuallyNonEmptyLayout WK_API_AVAILABLE(macos(10.11), ios(9.0)) = 1 << 1, 33 | _WKRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2, 34 | _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold WK_API_AVAILABLE(macos(10.11), ios(9.0)) = 1 << 3, 35 | _WKRenderingProgressEventFirstLayoutAfterSuppressedIncrementalRendering WK_API_AVAILABLE(macos(10.11), ios(9.0)) = 1 << 4, 36 | _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering WK_API_AVAILABLE(macos(10.11), ios(9.0)) = 1 << 5, 37 | _WKRenderingProgressEventFirstPaint WK_API_AVAILABLE(macos(10.11), ios(9.0)) = 1 << 6, 38 | _WKRenderingProgressEventDidRenderSignificantAmountOfText WK_API_AVAILABLE(macos(10.14), ios(12.0)) = 1 << 7, 39 | _WKRenderingProgressEventFirstMeaningfulPaint WK_API_AVAILABLE(macos(10.14.4), ios(12.2)) = 1 << 8, 40 | } WK_API_AVAILABLE(macos(10.10), ios(8.0)); 41 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKSameDocumentNavigationType.h: -------------------------------------------------------------------------------- 1 | /* https://github.com/WebKit/webkit/blob/ce24e8d887968296a2acebd96c31797d36fb08ca/Source/WebKit2/Shared/API/Cocoa/_WKSameDocumentNavigationType.h 2 | * Copyright (C) 2014 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | typedef NS_ENUM(NSInteger, _WKSameDocumentNavigationType) { 29 | _WKSameDocumentNavigationTypeAnchorNavigation, 30 | _WKSameDocumentNavigationTypeSessionStatePush, 31 | _WKSameDocumentNavigationTypeSessionStateReplace, 32 | _WKSameDocumentNavigationTypeSessionStatePop, 33 | } WK_CLASS_AVAILABLE(macos(10.10), ios(8.0)); 34 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKThumbnailView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.h 3 | * 4 | * Copyright (C) 2014 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #if !TARGET_OS_IPHONE 31 | 32 | #import 33 | 34 | @class WKView; 35 | @class WKWebView; 36 | 37 | WK_CLASS_AVAILABLE(macos(10.10), ios(8.0)) 38 | @interface _WKThumbnailView : NSView 39 | 40 | #pragma clang diagnostic push 41 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 42 | - (instancetype)initWithFrame:(NSRect)frame fromWKView:(WKView *)wkView; 43 | #pragma clang diagnostic pop 44 | - (instancetype)initWithFrame:(NSRect)frame fromWKWebView:(WKWebView *)webView; 45 | 46 | @property (nonatomic) CGFloat scale; 47 | @property (nonatomic, readonly) CGSize snapshotSize; 48 | @property (nonatomic) CGSize maximumSnapshotSize; 49 | @property (nonatomic) BOOL exclusivelyUsesSnapshot; 50 | 51 | // Defaults to NO. 52 | @property (nonatomic) BOOL shouldKeepSnapshotWhenRemovedFromSuperview; 53 | 54 | @property (strong, nonatomic) NSColor *overrideBackgroundColor; 55 | 56 | - (void)requestSnapshot; 57 | 58 | @end 59 | 60 | #endif // TARGET_OS_IPHONE 61 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKUserStyleSheet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheet.h 3 | * 4 | * Copyright (C) 2015 Apple Inc. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | * THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | 31 | #import 32 | 33 | NS_ASSUME_NONNULL_BEGIN 34 | 35 | @class _WKUserContentWorld; 36 | 37 | WK_CLASS_AVAILABLE(macos(10.12), ios(10.0)) 38 | @interface _WKUserStyleSheet : NSObject 39 | 40 | @property (nonatomic, readonly, copy) NSString *source; 41 | 42 | @property (nonatomic, readonly, copy) NSURL *baseURL; 43 | 44 | @property (nonatomic, readonly, getter=isForMainFrameOnly) BOOL forMainFrameOnly; 45 | 46 | - (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly; 47 | - (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray *)legacyWhitelist legacyBlacklist:(NSArray *)legacyBlacklist userContentWorld:(_WKUserContentWorld *)userContentWorld; 48 | - (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray *)legacyWhitelist legacyBlacklist:(NSArray *)legacyBlacklist baseURL:(NSURL *)baseURL userContentWorld:(_WKUserContentWorld *)userContentWorld; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/_WKWebsiteDataStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | #import 29 | 30 | typedef NS_OPTIONS(NSUInteger, WKWebsiteDataTypes) { 31 | WKWebsiteDataTypeAll = NSUIntegerMax, 32 | } WK_API_AVAILABLE(macos(10.11), ios(9.0)); 33 | 34 | 35 | WK_CLASS_DEPRECATED_WITH_REPLACEMENT("WKWebsiteDataStore", macos(10.10, 10.11), ios(8.0, 9.0)) 36 | @interface _WKWebsiteDataStore : NSObject 37 | 38 | + (_WKWebsiteDataStore *)defaultDataStore; 39 | + (_WKWebsiteDataStore *)nonPersistentDataStore; 40 | 41 | @property (readonly, getter=isNonPersistent) BOOL nonPersistent; 42 | 43 | - (instancetype)initWithDataStore:(WKWebsiteDataStore *)dataStore; 44 | - (void)fetchDataRecordsOfTypes:(WKWebsiteDataTypes)websiteDataTypes completionHandler:(void (^)(NSArray *))completionHandler; 45 | - (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes forDataRecords:(NSArray *)dataRecords completionHandler:(void (^)(void))completionHandler; 46 | - (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes modifiedSince:(NSDate *)date completionHandler:(void (^)(void))completionHandler; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /modules/WebKitPrivates/module.modulemap: -------------------------------------------------------------------------------- 1 | module WebKitPrivates { 2 | requires objc 3 | link framework "WebKit" 4 | use "WebKit" 5 | 6 | // https://clang.llvm.org/docs/Modules.html#umbrella-directory-declaration 7 | umbrella "./" 8 | 9 | // requires c-plus-plus and WTF headers 10 | exclude header "WKReloadFrameErrorRecoveryAttempter.h" 11 | 12 | //export * 13 | //explicit module * { export * } 14 | 15 | // https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg68407.html 16 | // http://llvm.org/viewvc/llvm-project?view=revision&revision=313316 17 | // https://clang.llvm.org/docs/Modules.html#re-export-declaration 18 | //export_as WebKit 19 | } 20 | -------------------------------------------------------------------------------- /sites/DevDocs/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint-env builtins*/ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | "use strict"; 5 | 6 | var devdocs = {url: 'https://devdocs.io'}; 7 | 8 | var delegate = {}; // our delegate to receive events from the webview app 9 | 10 | function search(query) { 11 | $.browser.tabSelected = new $.WebView({url: "https://devdocs.io/#q="+query}); 12 | } 13 | delegate.launchURL = function(url) { 14 | console.log("app.js: launching " + url); 15 | var comps = url.split(':'), 16 | scheme = comps.shift(), 17 | addr = comps.shift(); 18 | switch (scheme + ':') { 19 | case 'devdocs:': 20 | search(addr); 21 | break; 22 | default: 23 | $.browser.tabSelected = new $.WebView({url: url}); 24 | } 25 | }; 26 | 27 | delegate.handleUserInputtedInvalidURL = function(query) { 28 | // assuming the invalid url is a search request 29 | search(encodeURI(query)); 30 | return true; // tell MacPin to stop validating the URL 31 | }; 32 | 33 | delegate.AppFinishedLaunching = function() { 34 | $.app.registerURLScheme('devdocs'); 35 | if ($.launchedWithURL != '') { // app was launched with a feed url 36 | this.launchURL($.launchedWithURL); 37 | $.launchedWithURL = ''; 38 | } else { 39 | $.browser.addShortcut('DevDocs', devdocs); 40 | $.browser.tabSelected = new $.WebView(devdocs); 41 | } 42 | }; 43 | delegate; //return this to macpin 44 | -------------------------------------------------------------------------------- /sites/DevDocs/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/DevDocs/icon.png -------------------------------------------------------------------------------- /sites/Facebook/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Facebook/icon.png -------------------------------------------------------------------------------- /sites/Facebook/styler.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var css = document.createElement("style"); 3 | css.type = 'text/css'; 4 | css.id = 'macpin' 5 | 6 | // make news feed take full width and jewel bar float at top 7 | css.innerHTML = "\ 8 | #header { position: fixed !important; top: 0px !important; }\ 9 | #main { width: auto !important; }\ 10 | ._e_- { max-width: 10000px !important; }\ 11 | .mHomeNewsfeed {\ 12 | margin-left: 0px !important;\ 13 | margin-right: 0px !important;\ 14 | }\ 15 | "; 16 | 17 | document.head.appendChild(css); 18 | })() 19 | -------------------------------------------------------------------------------- /sites/Facebook/unpreloader.js: -------------------------------------------------------------------------------- 1 | // pinched from Marc Hoyois' ClickToPlugin extension 2 | // https://hoyois.github.io/safariextensions/universalextension/#html5_blocker 3 | // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Introduction/Introduction.html 4 | document.addEventListener('beforeload', handleBeforeLoadEvent, true); 5 | 6 | function handleBeforeLoadEvent(event) { 7 | if (!(event.target instanceof HTMLMediaElement)) return; 8 | event.target.autoplay = false; 9 | event.target.preload = 'none'; 10 | event.target.controls = true ; 11 | console.log('video unpreloaded'); 12 | } 13 | -------------------------------------------------------------------------------- /sites/Google_Calendar/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Calendar/icon.png -------------------------------------------------------------------------------- /sites/Google_Chat/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Chat/icon.png -------------------------------------------------------------------------------- /sites/Google_Chat/main.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint-env es6*/ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | "use strict"; 5 | 6 | const {app, BrowserWindow, WebView} = require('@MacPin'); 7 | let browser = new BrowserWindow(); 8 | 9 | const chat = { 10 | url: "https://chat.google.com", 11 | }; 12 | let chatTab = new WebView(chat); // start loading right way, its a big Closure app 13 | 14 | function unhideApp(tab) { 15 | if (tab) browser.tabSelected = tab; 16 | browser.unhideApp(); 17 | }; 18 | 19 | const enDarken = require('enDarken.js'); 20 | 21 | const setAgent = function(agent, tab) { tab.userAgent = agent; }; 22 | // looks like a reload has to be done for this to take full effect. 23 | 24 | app.on("decideNavigationForClickedURL", function(url, tab, mainFrame) { 25 | if ( 26 | !url.startsWith("https://accounts.google.com") 27 | && !url.startsWith("https://hangouts.google.com") 28 | && !url.startsWith("https://www.google.com/a/") 29 | && !url.startsWith("https://g.co") 30 | ) { // open all links externally except those above 31 | app.openURL(url); 32 | return true; 33 | } 34 | if (url.startsWith("https://www.google.com/url?q=")) { 35 | // stripping obnoxious google redirector 36 | url = decodeURIComponent(url.slice(29)); 37 | app.openURL(url); 38 | return true; 39 | } 40 | if (!mainFrame) { 41 | console.log(``); 42 | } 43 | return false; 44 | }); 45 | 46 | app.on("postedDesktopNotification", (note, tab) => { 47 | console.log(Date() + `[${tab.url}] posted HTML5 desktop notification: ${note.id}`); 48 | console.log(JSON.stringify(note)); 49 | return false 50 | }); 51 | 52 | app.on('handleClickedNotification', (note) => { 53 | console.log("App signals a clicked notification: "+ JSON.stringify(note)); 54 | return false; 55 | }); 56 | 57 | 58 | app.on('AppWillFinishLaunching', (AppUI) => { 59 | browser.addShortcut("Log into Google Account", "https://accounts.google.com/signin"); 60 | browser.addShortcut('Dark Mode', [], enDarken); 61 | browser.addShortcut('UA: default', [false], setAgent); 62 | 63 | AppUI.browserController = browser; // make sure main app menu can get at our shortcuts 64 | enDarken(chatTab); 65 | }); 66 | 67 | 68 | app.on('AppFinishedLaunching', function(launchURLs) { 69 | browser.tabSelected = chatTab; 70 | }); 71 | -------------------------------------------------------------------------------- /sites/Google_Drive/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Drive/icon.png -------------------------------------------------------------------------------- /sites/Google_Maps/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Maps/icon.png -------------------------------------------------------------------------------- /sites/Google_Photos/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint-env builtins*/ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | "use strict"; 5 | 6 | var photosTab, photos = {url: 'https://photos.google.com'}, 7 | photosAlt = {url: 'https://photos.google.com/u/1'}; 8 | $.browser.tabSelected = photosTab = new $.WebView(photos); 9 | 10 | var delegate = {}; // our delegate to receive events from the webview app 11 | 12 | function search(query) { 13 | photosTab.loadURL("https://photos.google.com/search/"+query); // FIXME: do this in JS 14 | } 15 | 16 | delegate.launchURL = function(url) { 17 | console.log("app.js: launching " + url); 18 | var comps = url.split(':'), 19 | scheme = comps.shift(), 20 | addr = comps.shift(); 21 | switch (scheme) { 22 | case 'http': 23 | case 'https': 24 | case 'file': 25 | // prompt to do upload 26 | photosTab.evalJS('confirm("Upload '+url+'?");'); 27 | // http://stackoverflow.com/a/30565302/3878712 28 | // document.querySelector("input[type='file']").click() 29 | // document.querySelector("div[aria-label='Upload photos']").click() 30 | break; 31 | case 'googlephotos': 32 | case 'gphotos': 33 | search(addr); 34 | break; 35 | default: 36 | $.browser.tabSelected = new $.WebView({url: url}); 37 | } 38 | }; 39 | 40 | delegate.handleUserInputtedInvalidURL = function(query) { 41 | // assuming the invalid url is a search request 42 | search(encodeURI(query)); 43 | if ($.app.pathExists(query)) this.launchURL('file://' + query); 44 | else search(encodeURI(query)); // assuming the invalid url is a search request 45 | return true; // tell MacPin to stop validating the URL 46 | }; 47 | 48 | // handles all URLs drag-and-dropped into NON-html5 parts of Photos and Dock icon. 49 | delegate.handleDragAndDroppedURLs = function(urls) { 50 | console.log(urls); 51 | for (var url of urls) { 52 | this.launchURL(url); 53 | //$.browser.tabSelected = new $.WebView({url: url}); 54 | } 55 | return true; 56 | } 57 | 58 | delegate.AppFinishedLaunching = function() { 59 | $.app.registerURLScheme('googlephotos'); //IOS? 60 | $.app.registerURLScheme('gphotos'); 61 | $.browser.addShortcut('Google Photos', photos); 62 | $.browser.addShortcut('Google Photos (using secondary account)', photosAlt); 63 | $.browser.addShortcut('Picasa Web Albums', 'http://picasaweb.google.com/lh/myphotos?noredirect=1'); 64 | 65 | if ($.launchedWithURL != '') { // app was launched with a feed url 66 | this.launchURL($.launchedWithURL); 67 | $.launchedWithURL = ''; 68 | } 69 | }; 70 | delegate; //return this to macpin 71 | -------------------------------------------------------------------------------- /sites/Google_Photos/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Photos/icon.png -------------------------------------------------------------------------------- /sites/Google_Voice/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Google_Voice/icon.png -------------------------------------------------------------------------------- /sites/Hangouts/convopopper.js: -------------------------------------------------------------------------------- 1 | /* eslint-env browser */ 2 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 3 | 4 | if ((window.name == 'preld') || ~window.name.indexOf('gtn_')) { //frame-id ^gtn_ this is a chatbox iframe 5 | var btn; 6 | function autoPop() { 7 | // auto-tab all opened chats (via window.open) 8 | if (btn = document.querySelector('button[title="Pop-out"]')) { 9 | console.log("got a pop-out button!"); 10 | console.log(btn); 11 | //btn.click(); 12 | // goog.testing.events.fireClickSequence() 13 | // https://google.github.io/closure-library/api/source/closure/goog/testing/events/events.js.src.html#l165 14 | // https://github.com/google/closure-library/blob/master/closure/goog/testing/events/events.js#L165 15 | // https://github.com/google/closure-library/blob/master/closure/goog/events/browserevent.js 16 | // https://developers.google.com/closure/library/docs/introduction#evs 17 | // https://developers.google.com/closure/library/docs/closurebuilder 18 | btn[Object.keys(btn)[0]].$.click[0].proxy(); // btn.closure_lm_54596 ... 19 | } 20 | 21 | //setTimeout(webkit.messageHandlers.SwitchToThisTab.postMessage, 3000, []); 22 | } 23 | 24 | setTimeout(autoPop, 4000); 25 | webkit.messageHandlers.SwitchToThisTab.postMessage([]); 26 | }; 27 | -------------------------------------------------------------------------------- /sites/Hangouts/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Hangouts/icon.png -------------------------------------------------------------------------------- /sites/Hangouts/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Hangouts/screenshot.jpg -------------------------------------------------------------------------------- /sites/Hangouts/style.css: -------------------------------------------------------------------------------- 1 | body { overflow: hidden; background-color: transparent !important; font-family: -apple-system-font !important; } 2 | div, li, input { font-family: -apple-system-font !important; } 3 | *[role="button"] { font-size: 9pt !important; } 4 | #gb, #gba { display: none; } 5 | #hangout-landing-chat { left: 60px !important; top: 0px !important; width: 275px !important; background: none !important; } 6 | div[aria-label='Open background photo'] > div { background-image: none !important; background: none !important; } 7 | #hangout-landing-chat + div { background-color: none !important; } 8 | #hangout-landing-chat + div > div > div { display: none !important; } 9 | #hangout-landing-chat + div + div { display: none !important; } 10 | img[aria-hidden="true"] { display: none !important; } 11 | body > div + div + div + div > div[jscontroller] + div { background: none !important; } 12 | /* img, video, object, iframe, span[data-emo] { filter: invert(1) hue-rotate(180deg); } */ 13 | /* .talk_iframe { font-family: -apple-system-font !important; font-size: 9pt !important; } */ 14 | -------------------------------------------------------------------------------- /sites/MacPin/Library/Script Libraries/test.jxa: -------------------------------------------------------------------------------- 1 | #!/usr/bin/osascript -l JavaScript 2 | /*eslint-env applescript*/ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | /*global delay:false*/ 5 | "use strict"; 6 | function doTest(args) { 7 | var script = Application.currentApplication(); 8 | script.includeStandardAdditions = true; 9 | script.displayNotification('JXA library!', { withTitle: 'test', subtitle: 'Done' }); 10 | script.displayAlert('library tested:' + JSON.stringify(args)); 11 | return args; 12 | } 13 | function run(args) { doTest(args); } 14 | // vim: set filetype=javascript: 15 | -------------------------------------------------------------------------------- /sites/MacPin/Library/Script Libraries/test.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/MacPin/Library/Script Libraries/test.scpt -------------------------------------------------------------------------------- /sites/MacPin/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/MacPin/icon.png -------------------------------------------------------------------------------- /sites/MacPin/media_player.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | MacPin Media Player 4 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sites/MacPin/playground.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | MacPin Playground 4 | 38 | 39 | 40 |
41 | 42 |
43 |
44 | 49 |
50 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /sites/MacPin/playgroundFrame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | MacPin REPL output 4 | 18 | 21 | 22 | 23 |
24 | /* Welcome to the MacPin Playground!
25 |  *
26 |  * You can enter JavaScript commands to inspect and control this browser and its tabs.
27 |  * Named references (ex: this, app, browser, browser.tabs) and function returns
28 |  * will be sent thru string-kit's inspector to show you all their properties.
29 |  */
30 | 		
31 | 32 | 33 | -------------------------------------------------------------------------------- /sites/MacPin/repl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | MacPin REPL: app.js 4 | 45 | 46 | 47 |
48 | 56 |
57 | 62 | 63 |
64 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /sites/Messenger/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint-env builtins*/ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | "use strict"; 5 | 6 | let enDarken = require('enDarken.js'); 7 | 8 | var messenger = { 9 | url: 'https://www.messenger.com' 10 | }; 11 | 12 | var delegate = {}; // our delegate to receive events from the webview app 13 | 14 | delegate.launchURL = function(url) { 15 | console.log("app.js: launching " + url); 16 | var comps = url.split(':'), 17 | scheme = comps.shift(), 18 | addr = comps.shift(); 19 | switch (scheme + ':') { 20 | default: 21 | $.browser.tabSelected = new $.WebView({url: url}); 22 | } 23 | }; 24 | 25 | delegate.decideNavigationForURL = function(url) { 26 | var comps = url.split(':'), 27 | scheme = comps.shift(), 28 | addr = comps.shift(), 29 | subpath = addr.split('/')[1]; 30 | switch (scheme) { 31 | case "http": 32 | case "https": // https://github.com/rsms/fb-mac-messenger/blob/master/Messenger/AppDelegate.mm#L591 33 | // https://www.messenger.com/login/fb_iframe_target/?userid=&name=&secret=&persistent=1&initial_request_id= 34 | if ( 35 | (addr.startsWith("//www.messenger.com") || addr.startsWith("//www.facebook.com")) && 36 | (subpath == "login" || subpath == "checkpoint") 37 | ) { 38 | $.app.openURL(url); //pop all external links to system browser 39 | console.log("opened "+url+" externally!"); 40 | return true; //tell webkit to do nothing 41 | } 42 | case "about": 43 | case "file": 44 | default: 45 | return false; 46 | } 47 | }; 48 | 49 | delegate.AppFinishedLaunching = function(launchURLs) { 50 | $.browser.addShortcut('Messenger', messenger); 51 | $.browser.addShortcut('Dark Mode', [], enDarken); 52 | $.browser.tabSelected = new $.WebView(messenger); 53 | }; 54 | delegate; //return this to macpin 55 | -------------------------------------------------------------------------------- /sites/Messenger/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Messenger/icon.png -------------------------------------------------------------------------------- /sites/Slack/autodark.css: -------------------------------------------------------------------------------- 1 | /* https://slack.engineering/building-dark-mode-on-desktop-811508b5d15f */ 2 | 3 | /* the picker is still painfully bright so lets fix that */ 4 | @media (prefers-color-scheme: dark) { 5 | body { 6 | background-color: #1a1d21 !important; 7 | color: #f8f8f8 !important; 8 | } 9 | .btn_outline { 10 | background-color: inherit !important; 11 | color: inherit !important; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sites/Slack/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Slack/icon.png -------------------------------------------------------------------------------- /sites/Stack_Overflow/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 3 | "use strict"; 4 | 5 | var delegate = {}; // our delegate to receive events from the webview app 6 | 7 | function search(query) { 8 | console.log(query); 9 | $.browser.tabSelected = new $.WebView({ 10 | url: "http://stackoverflow.com/search?q=" + query, 11 | agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B411" // mobile version uses full screen for content 12 | }); 13 | } 14 | delegate.launchURL = function(url) { 15 | console.log("app.js: launching " + url); 16 | var comps = url.split(':'), 17 | scheme = comps.shift(), 18 | addr = comps.shift(); 19 | switch (scheme + ':') { 20 | case 'stackoverflow:': 21 | search(addr); 22 | break; 23 | default: 24 | $.browser.tabSelected = new $.WebView({url: url}); 25 | } 26 | }; 27 | 28 | delegate.decideNavigationForURL = function(url) { 29 | var comps = url.split(':'), 30 | scheme = comps.shift(), 31 | addr = comps.shift(); 32 | switch (scheme) { 33 | case "http": 34 | case "https": 35 | if (!addr.startsWith("//stackoverflow.com") && 36 | !addr.startsWith("//stackexchange.com") && 37 | !addr.startsWith("//tpc.googlesyndication.com") 38 | ) { 39 | $.app.openURL(url); //pop all external links to system browser 40 | console.log("opened "+url+" externally!"); 41 | return true; //tell webkit to do nothing 42 | } 43 | case "about": 44 | case "file": 45 | default: 46 | return false; 47 | } 48 | }; 49 | 50 | delegate.handleUserInputtedInvalidURL = function(query) { 51 | // assuming the invalid url is a search request 52 | search(encodeURI(query)); 53 | return true; // tell MacPin to stop validating the URL 54 | }; 55 | 56 | delegate.AppFinishedLaunching = function() { 57 | $.app.registerURLScheme('stackoverflow'); 58 | if ($.launchedWithURL != '') { // app was launched with a feed url 59 | this.launchURL($.launchedWithURL); 60 | $.launchedWithURL = ''; 61 | } else { 62 | $.browser.tabSelected = new $.WebView({ 63 | url: "http://stackoverflow.com", 64 | agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B411" // mobile version uses full screen for content 65 | }); 66 | } 67 | }; 68 | 69 | delegate; //return this to macpin 70 | -------------------------------------------------------------------------------- /sites/Stack_Overflow/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Stack_Overflow/icon.png -------------------------------------------------------------------------------- /sites/Trello/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Trello/icon.png -------------------------------------------------------------------------------- /sites/Trello/navigator.js: -------------------------------------------------------------------------------- 1 | new_navigator = {}; 2 | for (var i in navigator) { 3 | new_navigator[i] = navigator[i]; 4 | } 5 | 6 | new_navigator.platform = 'MakIntel'; // Win 7 | new_navigator.userAgent = "ScMazilla/5.0 (Crapintosh; Intel Mak OS Z 10_10_2) ScmappleWabKat/600.3.18 (KHTML, like Gacko) Version/8.0.2 Smafari/600.2.5 Chrome/32"; 8 | //"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36" 9 | new_navigator.appVersion = new_navigator.userAgent; 10 | new_navigator.vendor = "Google, Inc." 11 | new_navigator.javaEnabled = function(){return false;}; 12 | navigator = new_navigator; 13 | 14 | 15 | /* 16 | var spoofUA = "ScMazilla/5.0 (Crapintosh; Intel Mak OS Z 10_10_2) ScmappleWabKat/600.3.18 (KHTML, like Gacko) Version/8.0.2 Smafari/600.2.5 Chrome/32"; 17 | //"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36" 18 | Object.assign(navigator, { 19 | platform: 'MakIntel', // Win 20 | userAgent: spoofUA, 21 | appVersion: spoofUA, 22 | vendor: "Google, Inc.", 23 | javaEnabled: function(){return false;} 24 | }); 25 | */ 26 | 27 | 28 | /* 29 | var __originalNavigator = navigator; 30 | navigator = new Object(); 31 | navigator.__proto__ = __originalNavigator; 32 | Object.defineProperty(navigator, "userAgent", { 33 | get: function () { 34 | return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36"; 35 | } 36 | }); 37 | */ 38 | -------------------------------------------------------------------------------- /sites/Trello/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Trello/screenshot.jpg -------------------------------------------------------------------------------- /sites/Trello/styler.js: -------------------------------------------------------------------------------- 1 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 2 | /*globals webkit, document, window, localStorage*/ 3 | 4 | "use strict"; 5 | 6 | var macpinIsTransparent; 7 | 8 | window.addEventListener("load", function(event) { 9 | webkit.messageHandlers.MacPinPollStates.postMessage(["transparent"]); 10 | }, false); 11 | 12 | window.addEventListener("MacPinWebViewChanged", function(event) { 13 | macpinIsTransparent = event.detail["transparent"]; 14 | customizeBG(); 15 | }, false); 16 | 17 | // TODO: subscribe to storage events so that customizing one Trello tab will signal all others 18 | // http://www.w3.org/TR/webstorage/#the-storage-event 19 | // https://developer.apple.com/library/safari/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/Name-ValueStorage/Name-ValueStorage.html#//apple_ref/doc/uid/TP40007256-CH6-SW6 20 | // https://developer.mozilla.org/en-US/docs/Web/Events/storage 21 | 22 | var customizeBG = function(el) { 23 | var overrideStockTrelloBlue = localStorage.overrideStockTrelloBlue; 24 | var darkMode = localStorage.darkMode; 25 | 26 | var css = document.getElementById('customizeBG'); 27 | if (!css) { 28 | css = document.createElement("style"); 29 | css.id = "customizeBG"; 30 | css.type = 'text/css'; 31 | } 32 | 33 | var stockTrelloBlue = "rgb(0, 121, 191)"; 34 | if (macpinIsTransparent) { 35 | css.innerHTML = 'body { background-color: transparent !important; } '; 36 | // could get rgb=getComputedStyle(document.body).backgroundColor.match(/[\d\.]+/g) and convert from original rgb() to rgba() 37 | // http://stackoverflow.com/q/6672374/3878712 http://davidwalsh.name/detect-invert-color 38 | document.body.style.backgroundColor = "transparent"; 39 | } else if ( (document.body.style.backgroundColor == stockTrelloBlue) && overrideStockTrelloBlue) { 40 | css.innerHTML = 'body { background-color: rgba('+overrideStockTrelloBlue+') !important; } '; 41 | document.body.style.backgroundColor = 'rgba('+overrideStockTrelloBlue+')'; 42 | } else { 43 | document.body.style.backgroundColor = stockTrelloBlue; 44 | css.innerHTML = '{}'; 45 | } 46 | 47 | if (darkMode) css.innerHTML += "\ 48 | body { -webkit-filter:invert(100%) hue-rotate(180deg); }\ 49 | input,img,video,.window-cover,.list-card-cover,.attachment-thumbnail-preview,.js-open-board,.board-background-select { -webkit-filter:invert(100%) hue-rotate(180deg); }\ 50 | span { color: black; }"; 51 | 52 | if (darkMode && !macpinIsTransparent && document.body.style.backgroundColor == "") document.body.style.backgroundColor = "black"; 53 | 54 | document.head.appendChild(css); 55 | }; 56 | 57 | // need to watch for changes to body["style"] so we can re-apply any custom settings after board navigations 58 | var bgWatch = new MutationObserver(function(muts) { customizeBG(); }); 59 | bgWatch.observe(document.body, { attributes: true, attributeFilter: ["style"], childList: false, characterData: false, subtree: false }); 60 | -------------------------------------------------------------------------------- /sites/Twitter/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint-env es6 */ 3 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 4 | "use strict"; 5 | 6 | var delegate = {}; // our delegate to receive events from the webview app 7 | 8 | delegate.AppFinishedLaunching = function() { 9 | $.browser.addShortcut('stop tab from preloading videos', ['injectTab', 'unpreloader', "preinject please kthx"]); 10 | // ^ https://hoyois.github.io/safariextensions/universalextension/#html5_blocker 11 | let agent = "Mozilla/5.0 (iPad; CPU OS 12 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/13F69 Twitter for iPad"; 12 | $.browser.tabSelected = new $.WebView({ url: "http://mobile.twitter.com", agent: agent}) 13 | }; 14 | 15 | let injectTab = require('app_injectTab.js'); 16 | delegate; //return this to macpin 17 | -------------------------------------------------------------------------------- /sites/Twitter/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/Twitter/icon.png -------------------------------------------------------------------------------- /sites/Twitter/unpreloader.js: -------------------------------------------------------------------------------- 1 | // pinched from Marc Hoyois' ClickToPlugin extension 2 | // https://hoyois.github.io/safariextensions/universalextension/#html5_blocker 3 | // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Introduction/Introduction.html 4 | document.addEventListener('beforeload', handleBeforeLoadEvent, true); 5 | 6 | function handleBeforeLoadEvent(event) { 7 | if (!(event.target instanceof HTMLMediaElement)) return; 8 | event.target.autoplay = false; 9 | event.target.preload = 'none'; 10 | event.target.controls = true ; 11 | console.log('video unpreloaded'); 12 | } 13 | -------------------------------------------------------------------------------- /sites/WhatsApp/app.js: -------------------------------------------------------------------------------- 1 | /*eslint-env applescript*/ 2 | /*eslint eqeqeq:0, quotes:0, space-infix-ops:0, curly:0*/ 3 | "use strict"; 4 | 5 | var delegate = {}; // our delegate to receive events from the webview app 6 | 7 | delegate.AppFinishedLaunching = function() { 8 | $.browser.tabSelected = new $.WebView({ 9 | url: "https://web.whatsapp.com/" 10 | }); 11 | }; 12 | 13 | delegate; //return this to macpin -------------------------------------------------------------------------------- /sites/WhatsApp/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kfix/MacPin/f809802cf4dc998fea548fb03afe0546c53abe69/sites/WhatsApp/icon.png -------------------------------------------------------------------------------- /templates/Resources/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf2580 2 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;\f1\fnil\fcharset0 HelveticaNeue-Bold;} 3 | {\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue0;\red9\green79\blue209; 4 | } 5 | {\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;\cssrgb\c0\c0\c0;\cssrgb\c0\c40784\c85490\cname linkColor; 6 | } 7 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}} 8 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} 9 | \margl1440\margr1440\vieww10800\viewh8400\viewkind0 10 | \deftab720 11 | \pard\pardeftab720\sl300\partightenfactor0 12 | 13 | \f0\fs24 \cf2 \expnd0\expndtw0\kerning0 14 | This app (excluding rendered web content) was made with:\cf3 \ 15 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sl300\partightenfactor0 16 | \ls1\ilvl0 17 | \f1\b \cf4 \kerning1\expnd0\expndtw0 {\listtext \uc0\u8226 }{\field{\*\fldinst{HYPERLINK "http://github.com/kfix/MacPin"}}{\fldrslt \expnd0\expndtw0\kerning0 18 | MacPin}} 19 | \f0\b0 \expnd0\expndtw0\kerning0 20 | \ 21 | \ls1\ilvl0 22 | \f1\b \kerning1\expnd0\expndtw0 {\listtext \uc0\u8226 }{\field{\*\fldinst{HYPERLINK "http://webkit.org/"}}{\fldrslt \expnd0\expndtw0\kerning0 23 | WebKit}} 24 | \f0\b0 \expnd0\expndtw0\kerning0 25 | \ 26 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sl300\partightenfactor0 27 | \ls1\ilvl0\cf4 \kerning1\expnd0\expndtw0 {\listtext \uc0\u8226 }{\field{\*\fldinst{HYPERLINK "https://github.com/mozilla/readability"}}{\fldrslt \expnd0\expndtw0\kerning0 28 | Readability.js}}\expnd0\expndtw0\kerning0 29 | \ 30 | \ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext \uc0\u8226 }{\field{\*\fldinst{HYPERLINK "https://github.com/cockscomb/UTIKit"}}{\fldrslt \expnd0\expndtw0\kerning0 31 | UTIKit}}\expnd0\expndtw0\kerning0 32 | \ 33 | \ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext \uc0\u8226 }{\field{\*\fldinst{HYPERLINK "https://github.com/andybest/linenoise-swift"}}{\fldrslt Linenoise-Swift}}\expnd0\expndtw0\kerning0 34 | \ 35 | } -------------------------------------------------------------------------------- /templates/Resources/Readability.css: -------------------------------------------------------------------------------- 1 | #readability-page-1 { 2 | margin-left: 10%; 3 | margin-right: 10%; 4 | margin-top: 5%; 5 | } 6 | -------------------------------------------------------------------------------- /templates/Resources/app_injectTab.js: -------------------------------------------------------------------------------- 1 | console.log(`require()d ${module.uri}`); 2 | module.exports = function(script, init, pre, tab) { 3 | // i really need a .nowinject to replace .postinject+reload 4 | if (pre ? tab.preinject(script) : tab.postinject(script)) { 5 | //if (init) tab.evalJS(`window.onload = Function("${init}"); window.location.reload(false)`); // ewww 6 | // .onload doesn't survive reload 7 | 8 | tab.reload(); 9 | // would like a way to block on reload() or supply it with a strictly-ordered callback 10 | // instead of just sitting for 2 seconds 11 | // tab.reloadThen(jscb) ... 12 | 13 | //if (init) setTimeout((js) => {tab.evalJS(js)}, 2, init); 14 | // arrow is a Function type, so setTimeout works 15 | //if (init) setTimeout(tab.evalJS, 2, init); 16 | // evalJS is a CallbackFunction type, so setTimeout bails 17 | if (init) setTimeout(tab.evalJS.bind(tab), 2, init); 18 | 19 | } else { // script is already injected, so just init it again 20 | if (init) tab.evalJS(init); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /templates/Resources/enDarken.css: -------------------------------------------------------------------------------- 1 | /* 2 | * enDarken inverts all elements to darken them, then double-inverts "lights" (images) 3 | * 4 | * https://github.com/alexanderby/darkreader/blob/master/src/config/sites_fixes.json 5 | * https://fullscreen.spec.whatwg.org/#user-agent-level-style-sheet-defaults 6 | * https://github.com/WebKit/webkit/blob/master/Source/WebCore/css/fullscreen.css 7 | */ 8 | 9 | @media not print { 10 | /* root inversion to darken all the (usually) bright pages */ 11 | :root:not(:root:-webkit-full-screen, :root:-webkit-full-screen-ancestor) { 12 | filter: invert(1) hue-rotate(180deg); 13 | } 14 | 15 | /* double-inversion to undarken all the image-like things in a page */ 16 | :matches([style*="background:url"],[style*="background-image:url"],[style*="background: url"],[style*="background-image: url"]):not(html,body,body>div,input,a,:-webkit-full-screen), /* I h8 these pseudo-img div's*/ 17 | :not(:not(html,body,body>div,input,a):matches([style*="background:url"],[style*="background-image:url"],[style*="background: url"], 18 | [style*="background-image: url"]),:-webkit-full-screen,.ytp-large-width-mode,.player_area *):not(:-webkit-full-screen):matches( 19 | /* image-like things, excluding children of pseudo-img's & fullscreened elems */ 20 | /* -ed: why can't anybody use