OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ |
6 #define IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ | 6 #define IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ |
7 | 7 |
8 #import <CoreGraphics/CoreGraphics.h> | 8 #import <CoreGraphics/CoreGraphics.h> |
9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
10 | 10 |
| 11 @protocol CRWContextMenuDelegate; |
11 @class WKWebView; | 12 @class WKWebView; |
12 | 13 |
13 namespace web { | 14 namespace web { |
14 class BrowserState; | 15 class BrowserState; |
15 | 16 |
16 // Returns a new WKWebView for displaying regular web content. | 17 // Returns a new WKWebView for displaying regular web content. |
17 // WKWebViewConfiguration object for resulting web view will be obtained from | 18 // WKWebViewConfiguration object for resulting web view will be obtained from |
18 // the given |browser_state|. | 19 // the given |browser_state|. |
19 // | 20 // |
20 // Preconditions for creation of a WKWebView: | 21 // Preconditions for creation of a WKWebView: |
21 // 1) |browser_state| is not null. | 22 // 1) |browser_state| is not null. |
22 // 2) web::BrowsingDataPartition is synchronized. | 23 // 2) web::BrowsingDataPartition is synchronized. |
23 // | 24 // |
24 WKWebView* BuildWKWebView(CGRect frame, BrowserState* browser_state); | 25 WKWebView* BuildWKWebView(CGRect frame, BrowserState* browser_state); |
25 | 26 |
| 27 // Returns a new WKWebView for displaying regular web content. |
| 28 // The returned WKWebView is equivalent to the one created by |BuildWKWebView| |
| 29 // but a context menu recognizer is attached to it. |
| 30 // On a long press, context_menu_delegate webView:handleContextMenu:| is called. |
| 31 // The custom context menu involves gesture recognizers on every touch and |
| 32 // JavaScript. It can have impact on performances. |
| 33 // Calling |BuildWKWebViewWithCustomContextMenu| with a |context_menu_delegate| |
| 34 // nil is equivalent to |BuildWKWebView|. |
| 35 WKWebView* BuildWKWebViewWithCustomContextMenu( |
| 36 CGRect frame, |
| 37 BrowserState* browser_state, |
| 38 id<CRWContextMenuDelegate> context_menu_delegate); |
| 39 |
26 } // web | 40 } // web |
27 | 41 |
28 #endif // IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ | 42 #endif // IOS_WEB_PUBLIC_WEB_VIEW_CREATION_UTIL_H_ |
OLD | NEW |