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

Unified Diff: ios/web/web_state/ui/crw_context_menu_controller.h

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 | « ios/web/public/web_view_creation_util.h ('k') | ios/web/web_state/ui/crw_context_menu_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_context_menu_controller.h
diff --git a/ios/web/web_state/ui/crw_context_menu_controller.h b/ios/web/web_state/ui/crw_context_menu_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..e068cafff4eb1753f70a669dda24d12f823dd117
--- /dev/null
+++ b/ios/web/web_state/ui/crw_context_menu_controller.h
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_
+#define IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_
+
+#import <Foundation/Foundation.h>
+#import <Webkit/Webkit.h>
+
+#import "ios/web/public/block_types.h"
+
+@protocol CRWContextMenuDelegate;
+@protocol CRWJSInjectionEvaluator;
+
+// A controller that will recognise context menu gesture on |webView|. This
+// controller will rely on a long press gesture recognizer and JavaScript to
+// determine the element on which context menu is triggered.
+// The trigger delay is slightly shorter that ths system's one.
+@interface CRWContextMenuController : NSObject
+
+// Installs the |CRWContextMenuController| on |webView|.
+// - |webView| cannot be nil. |webView| is not retained and caller is
+// responsible for keeping it alive.
+// - |injectionEvaluator| can proxy all javascript calls to |webView| to
+// sanitize the eveluated strings. If |injectionEvaluator| is nil, JavaScript
+// is directly executed on |webView|.
+// - This class relies on the pre-injection of base.js in webView.
+// - This class will perform gesture recognition and JavaScript on every touch
+// event on |webView| and can have performance impact.
+// TODO(crbug.com/228179): This class only triggers context menu on mainFrame.
+- (instancetype)initWithWebView:(WKWebView*)webView
+ injectionEvaluator:(id<CRWJSInjectionEvaluator>)injectionEvaluator
+ delegate:(id<CRWContextMenuDelegate>)delegate
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+#endif // IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_
« no previous file with comments | « ios/web/public/web_view_creation_util.h ('k') | ios/web/web_state/ui/crw_context_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698