diff options
Diffstat (limited to 'ios/web')
-rw-r--r-- | ios/web/web_state/ui/crw_wk_web_view_web_controller.mm | 1 | ||||
-rw-r--r-- | ios/web/web_state/web_view_creation_utils.h | 3 | ||||
-rw-r--r-- | ios/web/web_state/web_view_creation_utils.mm | 6 |
3 files changed, 10 insertions, 0 deletions
diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm index 1c1003b..c08ccab 100644 --- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm +++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm @@ -480,6 +480,7 @@ NSString* const kScriptImmediateName = @"crwebinvokeimmediate"; return [web::CreateWKWebView( CGRectZero, config, + self.webStateImpl->GetBrowserState(), self.webStateImpl->GetRequestGroupID(), [self useDesktopUserAgent]) autorelease]; } diff --git a/ios/web/web_state/web_view_creation_utils.h b/ios/web/web_state/web_view_creation_utils.h index 095670f..6bab9d1 100644 --- a/ios/web/web_state/web_view_creation_utils.h +++ b/ios/web/web_state/web_view_creation_utils.h @@ -33,9 +33,12 @@ UIWebView* CreateWebView(CGRect frame); // Creates and returns a WKWebView. The returned WKWebView will have a // user agent string that includes the |request_group_id|. +// |browser_state| cannot be null. The |configuration| should have the same +// WKProcessPool as the WKWebViewConfiguration associated with |browser_state|. // Note: Callers are responsible for releasing the returned WKWebView. WKWebView* CreateWKWebView(CGRect frame, WKWebViewConfiguration* configuration, + BrowserState* browser_state, NSString* request_group_id, BOOL use_desktop_user_agent); diff --git a/ios/web/web_state/web_view_creation_utils.mm b/ios/web/web_state/web_view_creation_utils.mm index 891a1ba..68f6570 100644 --- a/ios/web/web_state/web_view_creation_utils.mm +++ b/ios/web/web_state/web_view_creation_utils.mm @@ -126,8 +126,14 @@ UIWebView* CreateWebView(CGRect frame) { WKWebView* CreateWKWebView(CGRect frame, WKWebViewConfiguration* configuration, + BrowserState* browser_state, NSString* request_group_id, BOOL use_desktop_user_agent) { + DCHECK(browser_state); + WKWebViewConfigurationProvider& config_provider = + WKWebViewConfigurationProvider::FromBrowserState(browser_state); + DCHECK_EQ([config_provider.GetWebViewConfiguration() processPool], + [configuration processPool]); web::BuildAndRegisterUserAgentForUIWebView(request_group_id, use_desktop_user_agent); return CreateWKWebViewWithConfiguration(frame, configuration); |