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

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
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..17ecfcdbef6cdb7e94ea4a3e2446fb7dbbcbbacc
--- /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
+
+// Install the |CRWContextMenuController| on |webView|.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 s/Install/Installs
Olivier 2017/01/13 18:49:55 Done.
+// - |webView| cannot be nil.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 Please document that |webView| is not retained and
Olivier 2017/01/13 18:49:55 Done.
+// - |javaScriptDelegate| can proxy all javascript calls to |webView| to
+// sanitize the eveluated strings. If |javaScriptDelegate| is nil, JavaScript
+// is directly called on |webView|.
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 nit: s/called/executed
Olivier 2017/01/13 18:49:55 Done.
+// - 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
+ javaScriptDelegate:
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 s/javaScriptDelegate/injectionEvaluator
Olivier 2017/01/13 18:49:55 Done.
+ (id<CRWJSInjectionEvaluator>)javaScriptDelegate
Eugene But (OOO till 7-30) 2017/01/13 18:23:42 ditto
Olivier 2017/01/13 18:49:55 Done.
+ delegate:(id<CRWContextMenuDelegate>)delegate
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+#endif // IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698