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

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

Issue 2737943003: Moved window opening callback to WebStateDelegate. (Closed)
Patch Set: Rebased 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 a2f1da57271a871674acd36243f7da53ea3b6dd7..2489ded3d8368488174877eb4782bbfd297b39a4 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4341,11 +4341,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
@@ -4353,8 +4359,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 {
« no previous file with comments | « ios/web/public/web_state/web_state_delegate_bridge.h ('k') | ios/web/web_state/ui/crw_web_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698