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_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ | 5 #ifndef IOS_WEB_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ |
6 #define IOS_WEB_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ | 6 #define IOS_WEB_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ |
7 | 7 |
8 #import <CoreGraphics/CoreGraphics.h> | 8 #import <CoreGraphics/CoreGraphics.h> |
9 #import <WebKit/WebKit.h> | 9 #import <WebKit/WebKit.h> |
10 | 10 |
11 #include "ios/web/public/user_agent.h" | |
12 | |
13 @protocol CRWContextMenuDelegate; | 11 @protocol CRWContextMenuDelegate; |
14 | 12 |
15 // This file is a collection of functions that vend web views. | 13 // This file is a collection of functions that vend web views. |
16 namespace web { | 14 namespace web { |
17 class BrowserState; | 15 class BrowserState; |
18 | 16 |
19 // Creates a new WKWebView for displaying regular web content and registers a | 17 // Creates a new WKWebView for displaying regular web content and registers a |
20 // user agent for it. | 18 // user agent for it. |
21 // | 19 // |
22 // Preconditions for creation of a WKWebView: | 20 // Preconditions for creation of a WKWebView: |
23 // 1) |browser_state|, |configuration| are not null. | 21 // 1) |browser_state|, |configuration| are not null. |
24 // 2) web::BrowsingDataPartition is synchronized. | 22 // 2) web::BrowsingDataPartition is synchronized. |
25 // 3) The WKProcessPool of the configuration is the same as the WKProcessPool | 23 // 3) The WKProcessPool of the configuration is the same as the WKProcessPool |
26 // of the WKWebViewConfiguration associated with |browser_state|. | 24 // of the WKWebViewConfiguration associated with |browser_state|. |
27 // | 25 // |
28 WKWebView* BuildWKWebView(CGRect frame, | 26 WKWebView* BuildWKWebView(CGRect frame, |
29 WKWebViewConfiguration* configuration, | 27 WKWebViewConfiguration* configuration, |
30 BrowserState* browser_state, | 28 BrowserState* browser_state, |
31 UserAgentType user_agent_type, | 29 BOOL use_desktop_user_agent, |
32 id<CRWContextMenuDelegate> context_menu_delegate); | 30 id<CRWContextMenuDelegate> context_menu_delegate); |
33 | 31 |
34 // Creates and returns a new WKWebView for displaying regular web content. | 32 // Creates and returns a new WKWebView for displaying regular web content. |
35 // The preconditions for the creation of a WKWebView are the same as the | 33 // The preconditions for the creation of a WKWebView are the same as the |
36 // previous method. | 34 // previous method. |
37 WKWebView* BuildWKWebView(CGRect frame, | 35 WKWebView* BuildWKWebView(CGRect frame, |
38 WKWebViewConfiguration* configuration, | 36 WKWebViewConfiguration* configuration, |
39 BrowserState* browser_state, | 37 BrowserState* browser_state, |
40 UserAgentType user_agent_type); | 38 BOOL use_desktop_user_agent); |
41 | 39 |
42 // Creates and returns a new WKWebView for displaying regular web content. | 40 // Creates and returns a new WKWebView for displaying regular web content. |
43 // The preconditions for the creation of a WKWebView are the same as the | 41 // The preconditions for the creation of a WKWebView are the same as the |
44 // previous method. | 42 // previous method. |
45 WKWebView* BuildWKWebView(CGRect frame, | 43 WKWebView* BuildWKWebView(CGRect frame, |
46 WKWebViewConfiguration* configuration, | 44 WKWebViewConfiguration* configuration, |
47 BrowserState* browser_state); | 45 BrowserState* browser_state); |
48 | 46 |
49 } // namespace web | 47 } // namespace web |
50 | 48 |
51 #endif // IOS_WEB_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ | 49 #endif // IOS_WEB_WEB_STATE_WEB_VIEW_INTERNAL_CREATION_UTIL_H_ |
OLD | NEW |