diff options
Diffstat (limited to 'WebKitTools/MiniBrowser/mac')
4 files changed, 137 insertions, 10 deletions
diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m index efc9b37..2805157 100644 --- a/WebKitTools/MiniBrowser/mac/AppDelegate.m +++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m @@ -31,7 +31,7 @@ #import <WebKit2/WKStringCF.h> #import <WebKit2/WKContextPrivate.h> -static NSString *defaultURL = @"file:///Users/andersca/Desktop/t.html"; +static NSString *defaultURL = @"http://www.webkit.org/"; @implementation BrowserAppDelegate @@ -153,4 +153,44 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess processPageNamespace = 0; } +- (BrowserWindowController *)frontmostBrowserWindowController +{ + NSArray* windows = [NSApp windows]; + for (NSWindow* window in windows) { + id delegate = [window delegate]; + if ([delegate isKindOfClass:[BrowserWindowController class]]) + return (BrowserWindowController *)delegate; + } + + return 0; +} + +- (IBAction)openDocument:(id)sender +{ + NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain]; + [openPanel beginForDirectory:nil + file:nil + types:nil + modelessDelegate:self + didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) + contextInfo:0]; +} + +- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + [sheet autorelease]; + if (returnCode != NSOKButton || ![[sheet filenames] count]) + return; + + NSString* filePath = [[sheet filenames] objectAtIndex:0]; + + BrowserWindowController *controller = [self frontmostBrowserWindowController]; + if (!controller) { + controller = [[BrowserWindowController alloc] initWithPageNamespace:[self getCurrentPageNamespace]]; + [[controller window] makeKeyAndOrderFront:self]; + } + + [controller loadURLString:[[NSURL fileURLWithPath:filePath] absoluteString]]; +} + @end diff --git a/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib b/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib index dbd4344..64c4999 100644 --- a/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib +++ b/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib @@ -2,17 +2,16 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> - <string key="IBDocument.SystemVersion">10D573</string> - <string key="IBDocument.InterfaceBuilderVersion">740</string> + <string key="IBDocument.SystemVersion">10F569</string> + <string key="IBDocument.InterfaceBuilderVersion">800</string> <string key="IBDocument.AppKitVersion">1038.29</string> - <string key="IBDocument.HIToolboxVersion">460.00</string> + <string key="IBDocument.HIToolboxVersion">461.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">740</string> + <string key="NS.object.0">800</string> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -46,7 +45,7 @@ <string key="NSWindowTitle">Window</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="1006"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -57,6 +56,7 @@ <int key="NSvFlags">274</int> <string key="NSFrameSize">{776, 608}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> </object> @@ -65,6 +65,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{45, 618}, {699, 22}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1023147716"> @@ -104,6 +105,7 @@ <object class="NSPSMatrix" key="NSDrawMatrix"/> <string key="NSFrame">{{752, 621}, {16, 16}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSpiFlags">28936</int> <double key="NSMaxValue">1</double> </object> @@ -112,6 +114,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{8, 616}, {29, 25}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="366486485"> <int key="NSCellFlags">-2080244224</int> @@ -134,10 +137,12 @@ </object> <string key="NSFrameSize">{776, 658}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSFrameAutosaveName">Main Window</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> @@ -368,12 +373,52 @@ <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>fetch:</string> + <string>forceRepaint:</string> <string>reload:</string> + <string>removeReinsertWebView:</string> + <string>showHideWebView:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>fetch:</string> + <string>forceRepaint:</string> + <string>reload:</string> + <string>removeReinsertWebView:</string> + <string>showHideWebView:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">fetch:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">forceRepaint:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">reload:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">removeReinsertWebView:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">showHideWebView:</string> + <string key="candidateClassName">id</string> + </object> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -393,6 +438,35 @@ <string>NSTextField</string> </object> </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>containerView</string> + <string>progressIndicator</string> + <string>reloadButton</string> + <string>urlText</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBToOneOutletInfo"> + <string key="name">containerView</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">progressIndicator</string> + <string key="candidateClassName">NSProgressIndicator</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">reloadButton</string> + <string key="candidateClassName">NSButton</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">urlText</string> + <string key="candidateClassName">NSTextField</string> + </object> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">mac/BrowserWindowController.h</string> @@ -846,6 +920,13 @@ <string key="NS.key.0">showWindow:</string> <string key="NS.object.0">id</string> </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <string key="NS.key.0">showWindow:</string> + <object class="IBActionInfo" key="NS.object.0"> + <string key="name">showWindow:</string> + <string key="candidateClassName">id</string> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> @@ -854,6 +935,7 @@ </object> </object> <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <integer value="1060" key="NS.object.0"/> @@ -865,5 +947,9 @@ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../../MiniBrowser.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> + <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> + <string key="NS.key.0">NSRefreshTemplate</string> + <string key="NS.object.0">{10, 12}</string> + </object> </data> </archive> diff --git a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch index faa14fc..cb8ceae 100644 --- a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch +++ b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch @@ -33,4 +33,4 @@ #define LOG NSLog #else #define LOG(...) ((void)0) -#endif
\ No newline at end of file +#endif diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m index f52c98e..d7f2e36 100644 --- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m +++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m @@ -25,6 +25,7 @@ #include <Cocoa/Cocoa.h> #include <WebKit2/WKBundle.h> +#include <WebKit2/WKBundleFrame.h> #include <WebKit2/WKBundleInitialize.h> #include <WebKit2/WKBundlePage.h> #include <WebKit2/WKString.h> @@ -66,7 +67,7 @@ void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleF void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) { - CFURLRef cfURL = WKURLCopyCFURL(0, WKBundlePageGetMainFrameURL(page)); + CFURLRef cfURL = WKURLCopyCFURL(0, WKBundleFrameGetURL(WKBundlePageGetMainFrame(page))); LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]); CFRelease(cfURL); |