summaryrefslogtreecommitdiffstats
path: root/ios/web
diff options
context:
space:
mode:
authorshreyasv <shreyasv@chromium.org>2015-05-21 18:52:23 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-22 01:52:51 +0000
commit756e41dd2b2d12bc8ce56db44ac950e6713f4a30 (patch)
treee0076dbe836ba70aa0fed5d64416a08550571304 /ios/web
parent60cbbc9cd0b3ec405f33974bc1f8f388e2be23df (diff)
downloadchromium_src-756e41dd2b2d12bc8ce56db44ac950e6713f4a30.zip
chromium_src-756e41dd2b2d12bc8ce56db44ac950e6713f4a30.tar.gz
chromium_src-756e41dd2b2d12bc8ce56db44ac950e6713f4a30.tar.bz2
Created a CreateWKWebView method that takes a BrowserState along with other parameters
Also deprecated a CreateWKWebView method that does not take a BrowserState. This is a precursor towards implementing BrowserState, web view association. Also moved all callers in web/ to the new API. BUG=480507 Review URL: https://codereview.chromium.org/1150813003 Cr-Commit-Position: refs/heads/master@{#331046}
Diffstat (limited to 'ios/web')
-rw-r--r--ios/web/web_state/ui/crw_wk_web_view_web_controller.mm1
-rw-r--r--ios/web/web_state/web_view_creation_utils.h3
-rw-r--r--ios/web/web_state/web_view_creation_utils.mm6
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);