Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: ios/chrome/browser/ui/static_content/static_html_view_controller.mm

Issue 2627093003: Reuse context menu in StaticHTMLViewController (Closed)
Patch Set: feedback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/web/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ad0556a3409bc5f8a89e6b5dc93c923cdc41bd34 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,18 @@
}
#pragma mark -
+#pragma mark CRWContextMenuDelegate implementation
+
+- (BOOL)webView:(WKWebView*)webView
+ handleContextMenu:(const web::ContextMenuParams&)params {
+ if ([delegate_
+ respondsToSelector:@selector(nativeContent:handleContextMenu:)]) {
+ return [delegate_ nativeContent:self handleContextMenu:params];
+ }
+ return NO;
+}
+
+#pragma mark -
#pragma mark KVO callback
- (void)observeValueForKeyPath:(NSString*)keyPath
@@ -278,7 +292,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];
« no previous file with comments | « no previous file | ios/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698