Changeset 159902 in webkit
- Timestamp:
- Dec 1, 2013, 4:50:07 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Tools/ChangeLog ¶
r159900 r159902 1 2013-12-01 Dan Bernstein <mitz@apple.com> 2 3 [Mac] Transition MiniBrowser to the Cocoa API: policy delegate 4 https://bugs.webkit.org/show_bug.cgi?id=125046 5 6 Reviewed by Sam Weinig. 7 8 * MiniBrowser/mac/AppDelegate.m: 9 (-[BrowserAppDelegate newWindow:]): Added WK_API_ENABLED guards. 10 (-[BrowserAppDelegate openDocument:]): Ditto. 11 * MiniBrowser/mac/WK2BrowserWindowController.h: Ditto. Also moved ivar declarations from the 12 interface to the implementation. 13 * MiniBrowser/mac/WK2BrowserWindowController.m: 14 (-[WK2BrowserWindowController awakeFromNib]): Changed to set the policy delegate instead of 15 the policy client. 16 (-[WK2BrowserWindowController browsingContextController:decidePolicyForNavigationAction:decisionHandler:]): 17 Moved policy client implementation into this delegate method. 18 (-[WK2BrowserWindowController browsingContextController:decidePolicyForNewWindowAction:decisionHandler:]): 19 Ditto. 20 (-[WK2BrowserWindowController browsingContextController:decidePolicyForResponseAction:decisionHandler:]): 21 Ditto. 22 1 23 2013-12-01 Dan Bernstein <mitz@apple.com> 2 24 -
TabularUnified trunk/Tools/MiniBrowser/mac/AppDelegate.m ¶
r159900 r159902 126 126 if (![sender respondsToSelector:@selector(tag)] || [sender tag] == WebKit1NewWindowTag) 127 127 controller = [[WK1BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"]; 128 #if WK_API_ENABLED 128 129 else if ([sender tag] == WebKit2NewWindowTag) 129 130 controller = [[WK2BrowserWindowController alloc] initWithContext:_processContext pageGroup:_pageGroup]; 131 #endif 130 132 131 133 if (!controller) … … 193 195 } 194 196 197 #if WK_API_ENABLED 195 198 NSOpenPanel *openPanel = [NSOpenPanel openPanel]; 196 199 [openPanel beginWithCompletionHandler:^(NSInteger result) { … … 205 208 [newBrowserWindowController loadURLString:[url absoluteString]]; 206 209 }]; 210 #endif // WK_API_ENABLED 207 211 } 208 212 -
TabularUnified trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h ¶
r130571 r159902 26 26 #import "BrowserWindowController.h" 27 27 28 @interface WK2BrowserWindowController : BrowserWindowController<BrowserController> { 29 WKContextRef _context; 30 WKPageGroupRef _pageGroup; 31 WKView *_webView; 32 } 28 #if WK_API_ENABLED 29 30 @interface WK2BrowserWindowController : BrowserWindowController <BrowserController> 33 31 34 32 - (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup; 35 33 36 34 @end 35 36 #endif // WK_API_ENABLED -
TabularUnified trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m ¶
r159387 r159902 26 26 #import "WK2BrowserWindowController.h" 27 27 28 #if WK_API_ENABLED 29 28 30 #import "AppDelegate.h" 31 #import <WebKit2/WKBrowsingContextController.h> 32 #import <WebKit2/WKBrowsingContextPolicyDelegate.h> 29 33 #import <WebKit2/WKPagePrivate.h> 30 34 #import <WebKit2/WKStringCF.h> … … 32 36 #import <WebKit2/WKViewPrivate.h> 33 37 34 @interface WK2BrowserWindowController () 38 @interface WK2BrowserWindowController () <WKBrowsingContextPolicyDelegate> 35 39 - (void)didStartProgress; 36 40 - (void)didChangeProgress:(double)value; … … 45 49 @end 46 50 47 @implementation WK2BrowserWindowController 51 @implementation WK2BrowserWindowController { 52 WKContextRef _context; 53 WKPageGroupRef _pageGroup; 54 WKView *_webView; 55 } 48 56 49 57 - (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup … … 62 70 WKRelease(_context); 63 71 WKRelease(_pageGroup); 72 _webView.browsingContextController.policyDelegate = nil; 64 73 [_webView release]; 65 74 … … 411 420 { 412 421 [(WK2BrowserWindowController *)clientInfo validateToolbar]; 413 }414 415 // MARK: Policy Client Callbacks416 417 static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)418 {419 LOG(@"decidePolicyForNavigationAction");420 WKFramePolicyListenerUse(listener);421 }422 423 static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)424 {425 LOG(@"decidePolicyForNewWindowAction");426 WKFramePolicyListenerUse(listener);427 }428 429 static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)430 {431 WKFramePolicyListenerUse(listener);432 422 } 433 423 … … 667 657 }; 668 658 WKPageSetPageLoaderClient(_webView.pageRef, &loadClient); 669 670 WKPagePolicyClient policyClient = { 671 kWKPagePolicyClientCurrentVersion, 672 self, /* clientInfo */ 673 0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */ 674 decidePolicyForNewWindowAction, 675 0, /* decidePolicyForResponse_deprecatedForUseWithV */ 676 0, /* unableToImplementPolicy */ 677 decidePolicyForNavigationAction, 678 decidePolicyForResponse, 679 }; 680 WKPageSetPagePolicyClient(_webView.pageRef, &policyClient); 659 660 _webView.browsingContextController.policyDelegate = self; 681 661 682 662 WKPageUIClient uiClient = { … … 848 828 } 849 829 830 #pragma mark WKBrowsingContextPolicyDelegate 831 832 - (void)browsingContextController:(WKBrowsingContextController *)browsingContext decidePolicyForNavigationAction:(NSDictionary *)actionInformation decisionHandler:(WKPolicyDecisionHandler)decisionHandler 833 { 834 LOG(@"decidePolicyForNavigationAction"); 835 decisionHandler(WKPolicyDecisionAllow); 836 } 837 838 - (void)browsingContextController:(WKBrowsingContextController *)browsingContext decidePolicyForNewWindowAction:(NSDictionary *)actionInformation decisionHandler:(WKPolicyDecisionHandler)decisionHandler 839 { 840 LOG(@"decidePolicyForNewWindowAction"); 841 decisionHandler(WKPolicyDecisionAllow); 842 } 843 844 - (void)browsingContextController:(WKBrowsingContextController *)browsingContext decidePolicyForResponseAction:(NSDictionary *)actionInformation decisionHandler:(WKPolicyDecisionHandler)decisionHandler 845 { 846 decisionHandler(WKPolicyDecisionAllow); 847 } 848 850 849 @end 850 851 #endif // WK_API_ENABLED
Note:
See TracChangeset
for help on using the changeset viewer.