Chromium Code Reviews| Index: ios/web_view/internal/cwv_web_view.mm |
| diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm |
| index 6df0d2ac3845f06ea52ed5ef58bf542b43f1dcb7..1a1a1f1e024b5be4a176bfde3aa7fa3c3c44ffa1 100644 |
| --- a/ios/web_view/internal/cwv_web_view.mm |
| +++ b/ios/web_view/internal/cwv_web_view.mm |
| @@ -20,6 +20,7 @@ |
| #import "ios/web/public/web_state/web_state_delegate_bridge.h" |
| #import "ios/web/public/web_state/web_state_observer_bridge.h" |
| #import "ios/web_view/internal/cwv_html_element_internal.h" |
| +#import "ios/web_view/internal/cwv_navigation_action_internal.h" |
| #import "ios/web_view/internal/cwv_web_view_configuration_internal.h" |
| #import "ios/web_view/internal/translate/web_view_translate_client.h" |
| #include "ios/web_view/internal/web_view_browser_state.h" |
| @@ -227,6 +228,38 @@ |
| return YES; |
| } |
| +- (web::WebState*)webState:(web::WebState*)webState |
| + createNewWebStateForURL:(const GURL&)URL |
| + openerURL:(const GURL&)openerURL |
| + initiatedByUser:(BOOL)initiatedByUser { |
| + SEL selector = |
| + @selector(webView:createWebViewWithConfiguration:forNavigationAction:); |
| + if (![_UIDelegate respondsToSelector:selector]) { |
| + return nil; |
|
Eugene But (OOO till 7-30)
2017/03/16 18:48:56
s/nil/nullptr
michaeldo
2017/03/16 20:25:39
Done.
|
| + } |
| + |
| + NSURLRequest* request = |
| + [[NSURLRequest alloc] initWithURL:net::NSURLWithGURL(URL)]; |
| + CWVNavigationAction* navigationAction = |
| + [[CWVNavigationAction alloc] initWithRequest:request |
| + userInitiated:initiatedByUser]; |
| + // TODO(crbug.com/702298): Window created by CWVUIDelegate should be closable. |
| + CWVWebView* webView = [_UIDelegate webView:self |
| + createWebViewWithConfiguration:_configuration |
| + forNavigationAction:navigationAction]; |
| + if (webView) { |
|
Eugene But (OOO till 7-30)
2017/03/16 18:48:55
Optional nit:
Do you want to swap conditions for
michaeldo
2017/03/16 20:25:39
Done.
|
| + return webView->_webState.get(); |
| + } |
| + return nullptr; |
| +} |
| + |
| +- (void)closeWebState:(web::WebState*)webState { |
| + SEL selector = @selector(webViewDidClose:); |
| + if ([_UIDelegate respondsToSelector:selector]) { |
| + [_UIDelegate webViewDidClose:self]; |
| + } |
| +} |
| + |
| - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: |
| (web::WebState*)webState { |
| return _javaScriptDialogPresenter.get(); |