Index: ios/chrome/browser/ui/static_content/static_html_view_controller.mm |
diff --git a/ios/chrome/browser/ui/static_content/static_html_view_controller.mm b/ios/chrome/browser/ui/static_content/static_html_view_controller.mm |
index cd2e6331a2038863d3fd100e8e5f02b682194249..7ef3882dd0dbf0f02369b3595dca9eaead925a17 100644 |
--- a/ios/chrome/browser/ui/static_content/static_html_view_controller.mm |
+++ b/ios/chrome/browser/ui/static_content/static_html_view_controller.mm |
@@ -13,6 +13,7 @@ |
#include "base/mac/foundation_util.h" |
#include "base/mac/scoped_nsobject.h" |
#include "ios/web/public/referrer.h" |
+#import "ios/web/public/web_state/ui/crw_context_menu_delegate.h" |
#import "ios/web/public/web_state/ui/crw_native_content.h" |
#import "ios/web/public/web_view_creation_util.h" |
#import "net/base/mac/url_conversions.h" |
@@ -43,7 +44,8 @@ |
} |
@end |
-@interface StaticHtmlViewController ()<WKNavigationDelegate> { |
+@interface StaticHtmlViewController ()<CRWContextMenuDelegate, |
+ WKNavigationDelegate> { |
@private |
// The referrer that will be passed when navigating from this page. |
web::Referrer referrer_; |
@@ -210,6 +212,17 @@ |
} |
#pragma mark - |
+#pragma mark CRWContextMenuDelegate implementation |
Eugene But (OOO till 7-30)
2017/01/13 16:19:41
nit: Add a linebreak ?
Olivier
2017/01/13 18:08:58
Done.
|
+- (BOOL)webView:(WKWebView*)webView |
+ handleContextMenu:(const web::ContextMenuParams&)params { |
+ if ([delegate_ |
+ respondsToSelector:@selector(nativeContent:handleContextMenu:)]) { |
+ return [delegate_ nativeContent:self handleContextMenu:params]; |
Olivier
2017/01/13 10:20:26
I kept the current behavior of the delegate to pas
Eugene But (OOO till 7-30)
2017/01/13 16:19:41
Looks consistent with -[CRWWebController nativeCon
|
+ } |
+ return NO; |
+} |
+ |
+#pragma mark - |
#pragma mark KVO callback |
- (void)observeValueForKeyPath:(NSString*)keyPath |
@@ -278,7 +291,8 @@ |
- (void)ensureWebViewCreated { |
if (!webView_) { |
- WKWebView* webView = web::BuildWKWebView(CGRectZero, browserState_); |
+ WKWebView* webView = web::BuildWKWebViewWithCustomContextMenu( |
+ CGRectZero, browserState_, self); |
[webView addObserver:self forKeyPath:@"title" options:0 context:nullptr]; |
[webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | |
UIViewAutoresizingFlexibleHeight]; |