Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2737943003: Moved window opening callback to WebStateDelegate. (Closed)
Patch Set: Self review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 7004abe1238e6abad6897604ecbf05a43e78b256..ca95923e5107fef6eb823af168810854236d1a1b 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4361,11 +4361,17 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
NSString* referrer = [self referrerFromNavigationAction:action];
GURL openerURL =
referrer ? GURL(base::SysNSStringToUTF8(referrer)) : _documentURL;
- CRWWebController* child = [_delegate webController:self
- createWebControllerForURL:requestURL
- openerURL:openerURL
- initiatedByUser:[self userIsInteracting]];
- DCHECK(!child || child.sessionController.openedByDOM);
+
+ WebState* childWebState = _webStateImpl->CreateNewWebState(
+ requestURL, openerURL, [self userIsInteracting]);
+ if (!childWebState)
+ return nil;
+
+ CRWWebController* childWebController =
+ static_cast<WebStateImpl*>(childWebState)->GetWebController();
+
+ DCHECK(!childWebController ||
+ childWebController.sessionController.openedByDOM);
// WKWebView requires WKUIDelegate to return a child view created with
// exactly the same |configuration| object (exception is raised if config is
@@ -4373,8 +4379,8 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// WKWebViewConfigurationProvider are different objects because WKWebView
// makes a shallow copy of the config inside init, so every WKWebView
// owns a separate shallow copy of WKWebViewConfiguration.
- [child ensureWebViewCreatedWithConfiguration:configuration];
- return child.webView;
+ [childWebController ensureWebViewCreatedWithConfiguration:configuration];
+ return childWebController.webView;
}
- (void)webViewDidClose:(WKWebView*)webView {

Powered by Google App Engine
This is Rietveld 408576698