Development:Opening URLs and Files
Jump to navigation
Jump to search
There are multiple ways that Camino can receive requests to open URLs or files from external applications, and thus multiple codepaths to handle these requests.
URLs
- openURL: in MainController handles URL-only drags to the Dock icon and URLs from our Open URL service.
- The pasteboard gives us unescaped Unicode URLs via this codepath.
- MainController’s init: checks NSUserDefaults for the -url key, i.e.,
./Camino.app/Contents/MacOS/Camino -url http://caminobrowser.org
- Whatever provides that to us also gives us unescaped Unicode URLs.
- GetURLCommand.mm handles the GURL AppleEvent (opening links from external applications, the
open
command in the Terminal, and theopen location
AppleScript command).- While the
open
command in the Terminal and links from external apps come as percent-escaped URLs, theopen location
GURL AppleScript command sends unescaped URLs (at least on 10.5) just like user-defaults and the pasteboard :P
- While the
Files
- NSApplication delegate method application:openFile: in MainController.mm
- openPanelDidEnd: in MainController.mm
- GetURLCommand.mm
In all three cases, we rely on decodeLocalFileURL: in NSURL+Utils.m to parse URLs out of URL-container files (old- and new-style .weblocs, .caminobookmarks, and IE .url files).