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 ff7c2d1e01182d1fec1f846744d6a9de1582f80c..69062dd8320be0354d44cc1c81a9ce9721c81d36 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_website_data_store_internal.h" |
| #import "ios/web_view/internal/translate/web_view_translate_client.h" |
| #include "ios/web_view/internal/web_view_browser_state.h" |
| @@ -50,6 +51,8 @@ |
| // can be used to send KVO notification. |
| @property(nonatomic, readwrite) double estimatedProgress; |
| +//@property(nonatomic, readonly) web::WebState estimatedProgress; |
|
Eugene But (OOO till 7-30)
2017/03/16 17:09:02
Please remove this
michaeldo
2017/03/16 18:24:28
Done.
|
| + |
| @end |
| @implementation CWVWebView |
| @@ -228,6 +231,35 @@ |
| 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; |
| + } |
| + |
| + NSURLRequest* request = |
| + [[NSURLRequest alloc] initWithURL:net::NSURLWithGURL(URL)]; |
| + CWVNavigationAction* navigationAction = |
| + [[CWVNavigationAction alloc] initWithRequest:request |
| + userInitiated:initiatedByUser]; |
| + CWVWebView* webView = [_UIDelegate webView:self |
| + createWebViewWithConfiguration:_configuration |
| + forNavigationAction:navigationAction]; |
|
Eugene But (OOO till 7-30)
2017/03/16 17:09:02
This will create a non-closable window. WebState c
michaeldo
2017/03/16 18:24:28
Thank you for the details, I have created a bug an
|
| + return webView->_webState.get(); |
|
Eugene But (OOO till 7-30)
2017/03/16 17:09:02
This will crash if |webView| is nil.
michaeldo
2017/03/16 18:24:28
I've added a check that a webview was in fact retu
|
| +} |
| + |
| +- (void)closeWebState:(web::WebState*)webState { |
| + SEL selector = @selector(webViewDidClose:); |
| + if (![_UIDelegate respondsToSelector:selector]) { |
|
Eugene But (OOO till 7-30)
2017/03/16 17:09:02
nit: How about this?:
if ([_UIDelegate respondsTo
michaeldo
2017/03/16 18:24:28
Done.
|
| + return; |
| + } |
| + [_UIDelegate webViewDidClose:self]; |
| +} |
| + |
| - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: |
| (web::WebState*)webState { |
| return _javaScriptDialogPresenter.get(); |