| Index: ios/web/web_state/ui/wk_web_view_configuration_provider.mm
|
| diff --git a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
|
| index 3370fad17f786507df5c1874479dcdeb2c71ad2b..17d135e230c0458ad15ed689c3015c2010e9e113 100644
|
| --- a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
|
| +++ b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
|
| @@ -21,9 +21,9 @@ const char kWKWebViewConfigProviderKeyName[] = "wk_web_view_config_provider";
|
|
|
| // Returns an autoreleased instance of WKUserScript to be added to
|
| // configuration's userContentController.
|
| -WKUserScript* InternalGetEarlyPageScript() {
|
| +WKUserScript* InternalGetEarlyPageScript(BrowserState* browser_state) {
|
| return [[[WKUserScript alloc]
|
| - initWithSource:GetEarlyPageScript()
|
| + initWithSource:GetEarlyPageScript(browser_state)
|
| injectionTime:WKUserScriptInjectionTimeAtDocumentStart
|
| forMainFrameOnly:YES] autorelease];
|
| }
|
| @@ -36,18 +36,17 @@ WKWebViewConfigurationProvider::FromBrowserState(BrowserState* browser_state) {
|
| DCHECK([NSThread isMainThread]);
|
| DCHECK(browser_state);
|
| if (!browser_state->GetUserData(kWKWebViewConfigProviderKeyName)) {
|
| - bool is_off_the_record = browser_state->IsOffTheRecord();
|
| browser_state->SetUserData(
|
| kWKWebViewConfigProviderKeyName,
|
| - new WKWebViewConfigurationProvider(is_off_the_record));
|
| + new WKWebViewConfigurationProvider(browser_state));
|
| }
|
| return *(static_cast<WKWebViewConfigurationProvider*>(
|
| browser_state->GetUserData(kWKWebViewConfigProviderKeyName)));
|
| }
|
|
|
| WKWebViewConfigurationProvider::WKWebViewConfigurationProvider(
|
| - bool is_off_the_record)
|
| - : is_off_the_record_(is_off_the_record) {}
|
| + BrowserState* browser_state)
|
| + : browser_state_(browser_state) {}
|
|
|
| WKWebViewConfigurationProvider::~WKWebViewConfigurationProvider() {
|
| }
|
| @@ -57,7 +56,7 @@ WKWebViewConfigurationProvider::GetWebViewConfiguration() {
|
| DCHECK([NSThread isMainThread]);
|
| if (!configuration_) {
|
| configuration_.reset([[WKWebViewConfiguration alloc] init]);
|
| - if (is_off_the_record_) {
|
| + if (browser_state_->IsOffTheRecord()) {
|
| [configuration_
|
| setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
|
| }
|
| @@ -67,7 +66,7 @@ WKWebViewConfigurationProvider::GetWebViewConfiguration() {
|
| // setJavaScriptCanOpenWindowsAutomatically is required to support popups.
|
| [[configuration_ preferences] setJavaScriptCanOpenWindowsAutomatically:YES];
|
| [[configuration_ userContentController]
|
| - addUserScript:InternalGetEarlyPageScript()];
|
| + addUserScript:InternalGetEarlyPageScript(browser_state_)];
|
| }
|
| // Prevent callers from changing the internals of configuration.
|
| return [[configuration_ copy] autorelease];
|
|
|