DefaultPolicyDelegate.m 978 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // DefaultPolicyDelegate.m
  3. // DumpRenderTree
  4. //
  5. // Created by Anders Carlsson on 7/9/13.
  6. //
  7. //
  8. #import "DefaultPolicyDelegate.h"
  9. #import <WebKit/WebPolicyDelegatePrivate.h>
  10. #import <WebKit/WebViewPrivate.h>
  11. @implementation DefaultPolicyDelegate
  12. - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener
  13. {
  14. if ([WebView _canHandleRequest:request]) {
  15. [listener use];
  16. return;
  17. }
  18. WebNavigationType navType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
  19. if (navType == WebNavigationTypePlugInRequest) {
  20. [listener use];
  21. return;
  22. }
  23. // The default WebKit policy delegate passes the URL along to -[NSWorkspace openURL:] here,
  24. // but we don't want to do that so we just ignore the navigation completely.
  25. [listener ignore];
  26. }
  27. @end