| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/web/web_state/web_state_delegate_stub.h" | 5 #import "ios/web/web_state/web_state_delegate_stub.h" |
| 6 | 6 |
| 7 #import "ios/web/public/web_state/web_state.h" | 7 #import "ios/web/public/web_state/web_state.h" |
| 8 #import "ios/web/public/web_state/context_menu_params.h" | 8 #import "ios/web/public/web_state/context_menu_params.h" |
| 9 | 9 |
| 10 @implementation CRWWebStateDelegateStub { | 10 @implementation CRWWebStateDelegateStub { |
| 11 // Backs up the property with the same name. | 11 // Backs up the property with the same name. |
| 12 std::unique_ptr<web::WebState::OpenURLParams> _openURLParams; | 12 std::unique_ptr<web::WebState::OpenURLParams> _openURLParams; |
| 13 // Backs up the property with the same name. | 13 // Backs up the property with the same name. |
| 14 std::unique_ptr<web::ContextMenuParams> _contextMenuParams; | 14 std::unique_ptr<web::ContextMenuParams> _contextMenuParams; |
| 15 // Backs up the property with the same name. | 15 // Backs up the property with the same name. |
| 16 BOOL _javaScriptDialogPresenterRequested; | 16 BOOL _javaScriptDialogPresenterRequested; |
| 17 } | 17 } |
| 18 | 18 |
| 19 @synthesize webState = _webState; | 19 @synthesize webState = _webState; |
| 20 @synthesize changedProgress = _changedProgress; | 20 @synthesize changedProgress = _changedProgress; |
| 21 @synthesize repostFormWarningRequested = _repostFormWarningRequested; |
| 21 @synthesize authenticationRequested = _authenticationRequested; | 22 @synthesize authenticationRequested = _authenticationRequested; |
| 22 | 23 |
| 23 - (web::WebState*)webState:(web::WebState*)webState | 24 - (web::WebState*)webState:(web::WebState*)webState |
| 24 openURLWithParams:(const web::WebState::OpenURLParams&)params { | 25 openURLWithParams:(const web::WebState::OpenURLParams&)params { |
| 25 _webState = webState; | 26 _webState = webState; |
| 26 _openURLParams.reset(new web::WebState::OpenURLParams(params)); | 27 _openURLParams.reset(new web::WebState::OpenURLParams(params)); |
| 27 return webState; | 28 return webState; |
| 28 } | 29 } |
| 29 | 30 |
| 30 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress { | 31 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress { |
| 31 _webState = webState; | 32 _webState = webState; |
| 32 _changedProgress = progress; | 33 _changedProgress = progress; |
| 33 } | 34 } |
| 34 | 35 |
| 35 - (BOOL)webState:(web::WebState*)webState | 36 - (BOOL)webState:(web::WebState*)webState |
| 36 handleContextMenu:(const web::ContextMenuParams&)params { | 37 handleContextMenu:(const web::ContextMenuParams&)params { |
| 37 _webState = webState; | 38 _webState = webState; |
| 38 _contextMenuParams.reset(new web::ContextMenuParams(params)); | 39 _contextMenuParams.reset(new web::ContextMenuParams(params)); |
| 39 return YES; | 40 return YES; |
| 40 } | 41 } |
| 41 | 42 |
| 43 - (void)webState:(web::WebState*)webState |
| 44 runRepostFormDialogWithCompletionHandler:(void (^)(BOOL))handler { |
| 45 _webState = webState; |
| 46 _repostFormWarningRequested = YES; |
| 47 } |
| 48 |
| 42 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: | 49 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: |
| 43 (web::WebState*)webState { | 50 (web::WebState*)webState { |
| 44 _webState = webState; | 51 _webState = webState; |
| 45 _javaScriptDialogPresenterRequested = YES; | 52 _javaScriptDialogPresenterRequested = YES; |
| 46 return nil; | 53 return nil; |
| 47 } | 54 } |
| 48 | 55 |
| 49 - (void)webState:(web::WebState*)webState | 56 - (void)webState:(web::WebState*)webState |
| 50 didRequestHTTPAuthForProtectionSpace:(NSURLProtectionSpace*)protectionSpace | 57 didRequestHTTPAuthForProtectionSpace:(NSURLProtectionSpace*)protectionSpace |
| 51 proposedCredential:(NSURLCredential*)proposedCredential | 58 proposedCredential:(NSURLCredential*)proposedCredential |
| 52 completionHandler:(void (^)(NSString* username, | 59 completionHandler:(void (^)(NSString* username, |
| 53 NSString* password))handler { | 60 NSString* password))handler { |
| 54 _webState = webState; | 61 _webState = webState; |
| 55 _authenticationRequested = YES; | 62 _authenticationRequested = YES; |
| 56 } | 63 } |
| 57 | 64 |
| 58 - (const web::WebState::OpenURLParams*)openURLParams { | 65 - (const web::WebState::OpenURLParams*)openURLParams { |
| 59 return _openURLParams.get(); | 66 return _openURLParams.get(); |
| 60 } | 67 } |
| 61 | 68 |
| 62 - (web::ContextMenuParams*)contextMenuParams { | 69 - (web::ContextMenuParams*)contextMenuParams { |
| 63 return _contextMenuParams.get(); | 70 return _contextMenuParams.get(); |
| 64 } | 71 } |
| 65 | 72 |
| 66 - (BOOL)javaScriptDialogPresenterRequested { | 73 - (BOOL)javaScriptDialogPresenterRequested { |
| 67 return _javaScriptDialogPresenterRequested; | 74 return _javaScriptDialogPresenterRequested; |
| 68 } | 75 } |
| 69 | 76 |
| 70 @end | 77 @end |
| OLD | NEW |