OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_ |
| 6 #define IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 #import <Webkit/Webkit.h> |
| 10 |
| 11 #import "ios/web/public/block_types.h" |
| 12 |
| 13 @protocol CRWContextMenuDelegate; |
| 14 @protocol CRWJSInjectionEvaluator; |
| 15 |
| 16 // A controller that will recognise context menu gesture on |webView|. This |
| 17 // controller will rely on a long press gesture recognizer and JavaScript to |
| 18 // determine the element on which context menu is triggered. |
| 19 // The trigger delay is slightly shorter that ths system's one. |
| 20 @interface CRWContextMenuController : NSObject |
| 21 |
| 22 // Installs the |CRWContextMenuController| on |webView|. |
| 23 // - |webView| cannot be nil. |webView| is not retained and caller is |
| 24 // responsible for keeping it alive. |
| 25 // - |injectionEvaluator| can proxy all javascript calls to |webView| to |
| 26 // sanitize the eveluated strings. If |injectionEvaluator| is nil, JavaScript |
| 27 // is directly executed on |webView|. |
| 28 // - This class relies on the pre-injection of base.js in webView. |
| 29 // - This class will perform gesture recognition and JavaScript on every touch |
| 30 // event on |webView| and can have performance impact. |
| 31 // TODO(crbug.com/228179): This class only triggers context menu on mainFrame. |
| 32 - (instancetype)initWithWebView:(WKWebView*)webView |
| 33 injectionEvaluator:(id<CRWJSInjectionEvaluator>)injectionEvaluator |
| 34 delegate:(id<CRWContextMenuDelegate>)delegate |
| 35 NS_DESIGNATED_INITIALIZER; |
| 36 |
| 37 - (instancetype)init NS_UNAVAILABLE; |
| 38 |
| 39 @end |
| 40 |
| 41 #endif // IOS_WEB_WEB_STATE_UI_CRW_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |