OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CRW_WEB_USER_INTERFACE_DELEGATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_USER_INTERFACE_DELEGATE_H_ |
6 #define IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_USER_INTERFACE_DELEGATE_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_USER_INTERFACE_DELEGATE_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 @class CRWWebController; | 10 @class CRWWebController; |
11 class GURL; | |
12 | 11 |
13 // DEPRECATED, do not conform to this protocol and do not add any methods to it. | 12 // DEPRECATED, do not conform to this protocol and do not add any methods to it. |
14 // Use web::WebStateDelegate instead. | 13 // Use web::WebStateDelegate instead. |
15 // TODO(crbug.com/675001): Remove this protocol. | 14 // TODO(crbug.com/675001): Remove this protocol. |
16 @protocol CRWWebUserInterfaceDelegate<NSObject> | 15 @protocol CRWWebUserInterfaceDelegate<NSObject> |
17 | 16 |
18 @optional | 17 @optional |
19 // The JavaScript panel selectors below are only called by the web controller | |
20 // for builds with WKWebView enabled. | |
21 | |
22 // Displays a JavaScript alert with an OK button, showing the provided message. | |
23 // |completionHandler| is called after the OK button on the alert is tapped. | |
24 // If this selector isn't implemented, the completion handler provided by the | |
25 // web view will be called without any UI displayed. If this method is | |
26 // implemented, but |completionHandler| is not called then | |
27 // NSInternalInconsistencyException will be thrown. | |
28 - (void)webController:(CRWWebController*)webController | |
29 runJavaScriptAlertPanelWithMessage:(NSString*)message | |
30 requestURL:(const GURL&)requestURL | |
31 completionHandler:(void (^)(void))completionHandler; | |
32 | |
33 // Displays a JavaScript confirm alert with an OK and Cancel button, showing the | |
34 // provided message. |completionHandler| is called after a button is pressed, | |
35 // with |isConfirmed| indicating whether OK was pressed. If this selector isn't | |
36 // implemented, the completion handler provided by the web view will be called | |
37 // with |isConfirmed| = NO. If this method is implemented, but | |
38 // |completionHandler| is not called then NSInternalInconsistencyException will | |
39 // be thrown. | |
40 - (void)webController:(CRWWebController*)webController | |
41 runJavaScriptConfirmPanelWithMessage:(NSString*)message | |
42 requestURL:(const GURL&)requestURL | |
43 completionHandler: | |
44 (void (^)(BOOL isConfirmed))completionHandler; | |
45 | |
46 // Displays a JavaScript input alert with an OK and Cancel button, showing the | |
47 // provided message and default text. |completionHandler| is called after a | |
48 // button is pressed. If the OK button is pressed, |input| contains the user | |
49 // text. If the cancel but is pressed, |input| will be nil. If this selector | |
50 // isn't implemented, the completion handler provided by the web view will be | |
51 // called with |input| = nil. If this method is implemented, but | |
52 // |completionHandler| is not called then NSInternalInconsistencyException will | |
53 // be thrown. | |
54 - (void)webController:(CRWWebController*)webController | |
55 runJavaScriptTextInputPanelWithPrompt:(NSString*)message | |
56 defaultText:(NSString*)defaultText | |
57 requestURL:(const GURL&)requestURL | |
58 completionHandler: | |
59 (void (^)(NSString* input))completionHandler; | |
60 | 18 |
61 // Displays an HTTP authentication dialog. |completionHandler| should be called | 19 // Displays an HTTP authentication dialog. |completionHandler| should be called |
62 // with non-nil |username| and |password| if embedder wants to proceed with | 20 // with non-nil |username| and |password| if embedder wants to proceed with |
63 // authentication. If this selector isn't implemented or completion is called | 21 // authentication. If this selector isn't implemented or completion is called |
64 // with nil |username| and nil |password|, authentication will be cancelled. | 22 // with nil |username| and nil |password|, authentication will be cancelled. |
65 // If this method is implemented, but |handler| is not called then | 23 // If this method is implemented, but |handler| is not called then |
66 // NSInternalInconsistencyException will be thrown. | 24 // NSInternalInconsistencyException will be thrown. |
67 - (void)webController:(CRWWebController*)webController | 25 - (void)webController:(CRWWebController*)webController |
68 runAuthDialogForProtectionSpace:(NSURLProtectionSpace*)protectionSpace | 26 runAuthDialogForProtectionSpace:(NSURLProtectionSpace*)protectionSpace |
69 proposedCredential:(NSURLCredential*)credential | 27 proposedCredential:(NSURLCredential*)credential |
70 completionHandler: | 28 completionHandler: |
71 (void (^)(NSString* user, NSString* password))handler; | 29 (void (^)(NSString* user, NSString* password))handler; |
72 | 30 |
73 // Cancels any outstanding dialogs requested by the methods above. | 31 // Cancels any outstanding dialogs requested by the methods above. |
74 - (void)cancelDialogsForWebController:(CRWWebController*)webController; | 32 - (void)cancelDialogsForWebController:(CRWWebController*)webController; |
75 | 33 |
76 @end | 34 @end |
77 | 35 |
78 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_USER_INTERFACE_DELEGATE_H_ | 36 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_USER_INTERFACE_DELEGATE_H_ |
OLD | NEW |