| 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 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // between 0.0 (nothing loaded) to 1.0 (page fully loaded). | 23 // between 0.0 (nothing loaded) to 1.0 (page fully loaded). |
| 24 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress; | 24 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress; |
| 25 | 25 |
| 26 // Called when the user triggers the context menu with the given | 26 // Called when the user triggers the context menu with the given |
| 27 // |ContextMenuParams|. Returns YES if the context menu operation was | 27 // |ContextMenuParams|. Returns YES if the context menu operation was |
| 28 // handled by the delegate. If this method is not implemented, the system | 28 // handled by the delegate. If this method is not implemented, the system |
| 29 // context menu will be displayed. | 29 // context menu will be displayed. |
| 30 - (BOOL)webState:(web::WebState*)webState | 30 - (BOOL)webState:(web::WebState*)webState |
| 31 handleContextMenu:(const web::ContextMenuParams&)params; | 31 handleContextMenu:(const web::ContextMenuParams&)params; |
| 32 | 32 |
| 33 // Requests the repost form confirmation dialog. Clients must call |handler| |
| 34 // with YES to allow repost and with NO to cancel the repost. If this method is |
| 35 // not implemented then WebState will repost the form. |
| 36 - (void)webState:(web::WebState*)webState |
| 37 runRepostFormDialogWithCompletionHandler:(void (^)(BOOL))handler; |
| 38 |
| 33 // Returns a pointer to a service to manage dialogs. May return null in which | 39 // Returns a pointer to a service to manage dialogs. May return null in which |
| 34 // case dialogs aren't shown. | 40 // case dialogs aren't shown. |
| 35 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: | 41 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: |
| 36 (web::WebState*)webState; | 42 (web::WebState*)webState; |
| 37 | 43 |
| 38 // Called when a request receives an authentication challenge specified by | 44 // Called when a request receives an authentication challenge specified by |
| 39 // |protectionSpace|, and is unable to respond using cached credentials. | 45 // |protectionSpace|, and is unable to respond using cached credentials. |
| 40 // Clients must call |handler| even if they want to cancel authentication | 46 // Clients must call |handler| even if they want to cancel authentication |
| 41 // (in which case |username| or |password| should be nil). | 47 // (in which case |username| or |password| should be nil). |
| 42 - (void)webState:(web::WebState*)webState | 48 - (void)webState:(web::WebState*)webState |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 public: | 59 public: |
| 54 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); | 60 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); |
| 55 ~WebStateDelegateBridge() override; | 61 ~WebStateDelegateBridge() override; |
| 56 | 62 |
| 57 // web::WebStateDelegate methods. | 63 // web::WebStateDelegate methods. |
| 58 WebState* OpenURLFromWebState(WebState*, | 64 WebState* OpenURLFromWebState(WebState*, |
| 59 const WebState::OpenURLParams&) override; | 65 const WebState::OpenURLParams&) override; |
| 60 void LoadProgressChanged(WebState* source, double progress) override; | 66 void LoadProgressChanged(WebState* source, double progress) override; |
| 61 bool HandleContextMenu(WebState* source, | 67 bool HandleContextMenu(WebState* source, |
| 62 const ContextMenuParams& params) override; | 68 const ContextMenuParams& params) override; |
| 69 void ShowRepostFormWarningDialog( |
| 70 WebState* source, |
| 71 const base::Callback<void(bool)>& callback) override; |
| 63 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter( | 72 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter( |
| 64 WebState* source) override; | 73 WebState* source) override; |
| 65 void OnAuthRequired(WebState* source, | 74 void OnAuthRequired(WebState* source, |
| 66 NSURLProtectionSpace* protection_space, | 75 NSURLProtectionSpace* protection_space, |
| 67 NSURLCredential* proposed_credential, | 76 NSURLCredential* proposed_credential, |
| 68 const AuthCallback& callback) override; | 77 const AuthCallback& callback) override; |
| 69 | 78 |
| 70 private: | 79 private: |
| 71 // CRWWebStateDelegate which receives forwarded calls. | 80 // CRWWebStateDelegate which receives forwarded calls. |
| 72 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; | 81 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; |
| 73 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); | 82 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); |
| 74 }; | 83 }; |
| 75 | 84 |
| 76 } // web | 85 } // web |
| 77 | 86 |
| 78 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ | 87 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| OLD | NEW |