OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_CONTROLLER_OBSERVER_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_ |
6 #define IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 @class CRWWebController; | 11 @class CRWWebController; |
12 @class CRWWebViewProxy; | 12 @protocol CRWWebViewProxy; |
13 class GURL; | 13 class GURL; |
14 @class UIWebView; | 14 @class UIWebView; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 } | 18 } |
19 | 19 |
20 // NOTE: When adding new methods to CRWWebControllerObserver, consider adding | 20 // NOTE: When adding new methods to CRWWebControllerObserver, consider adding |
21 // them to WebStateObserver instead if they need to be surfaced to the public | 21 // them to WebStateObserver instead if they need to be surfaced to the public |
22 // API. | 22 // API. |
23 @protocol CRWWebControllerObserver<NSObject> | 23 @protocol CRWWebControllerObserver<NSObject> |
24 | 24 |
25 @optional | 25 @optional |
26 | 26 |
27 // Supplies a text prefix to the CRWWebController to indicate which commands the | 27 // Supplies a text prefix to the CRWWebController to indicate which commands the |
28 // observer should receive using the handleCommand message. | 28 // observer should receive using the handleCommand message. |
29 // Called only as the observer is added to its parent CRWWebController. | 29 // Called only as the observer is added to its parent CRWWebController. |
30 @property(nonatomic, readonly) NSString* commandPrefix; | 30 @property(nonatomic, readonly) NSString* commandPrefix; |
31 | 31 |
32 // Called when the current page is loaded. | 32 // Called when the current page is loaded. |
33 // DEPRECATED: Use WebStateObserver instead. | 33 // DEPRECATED: Use WebStateObserver instead. |
34 - (void)pageLoaded:(CRWWebController*)webController; | 34 - (void)pageLoaded:(CRWWebController*)webController; |
35 | 35 |
36 // Called when a form is being submitted. | |
37 - (void)documentSubmit:(CRWWebController*)webController | |
38 formName:(const std::string&)formName | |
39 userInteraction:(BOOL)userInteraction; | |
40 | |
41 // Called when the user is typing on a form field, with |error| indicating if | |
42 // there is any error when parsing the form field information. Currently these | |
43 // events will not be sent if the Disable Autofill experiment is set. | |
44 - (void)formActivity:(CRWWebController*)webController | |
45 formName:(const std::string&)formName | |
46 fieldName:(const std::string&)fieldName | |
47 type:(const std::string&)type | |
48 value:(const std::string&)value | |
49 error:(bool)error; | |
50 | |
51 // Identical to |formActivity:formName:fieldName:type:value:error:|, but | |
52 // indicates that the activity was triggered by typing the key specified by | |
53 // |keyCode|. | |
54 - (void)formActivity:(CRWWebController*)webController | |
55 formName:(const std::string&)formName | |
56 fieldName:(const std::string&)fieldName | |
57 type:(const std::string&)type | |
58 value:(const std::string&)value | |
59 keyCode:(int)keyCode | |
60 error:(bool)error; | |
61 | |
62 // The page requested autocomplete. | |
63 - (void)requestAutocomplete:(CRWWebController*)webController | |
64 sourceURL:(const GURL&)sourceURL | |
65 formName:(const std::string&)formName | |
66 userInteraction:(BOOL)userInteraction; | |
67 | |
68 // Called when the web controller is about to close. | 36 // Called when the web controller is about to close. |
69 - (void)webControllerWillClose:(CRWWebController*)webController; | 37 - (void)webControllerWillClose:(CRWWebController*)webController; |
70 | 38 |
71 // Handle the command from page scripts. Return NO if the command was known to | 39 // Handle the command from page scripts. Return NO if the command was known to |
72 // be invalid. This will cause the page to be reset as a security precaution. | 40 // be invalid. This will cause the page to be reset as a security precaution. |
73 // DEPRECATED: Use WebState::ScriptCommandCallback instead. | 41 // DEPRECATED: Use WebState::ScriptCommandCallback instead. |
74 - (BOOL)handleCommand:(const base::DictionaryValue&)command | 42 - (BOOL)handleCommand:(const base::DictionaryValue&)command |
75 webController:(CRWWebController*)webController | 43 webController:(CRWWebController*)webController |
76 userIsInteracting:(BOOL)userIsInteracting | 44 userIsInteracting:(BOOL)userIsInteracting |
77 originURL:(const GURL&)originURL; | 45 originURL:(const GURL&)originURL; |
78 | 46 |
79 // Gives CRWWebControllerObservers access to the CRWWebViewProxy. | 47 // Gives CRWWebControllerObservers access to the CRWWebViewProxy. |
80 - (void)setWebViewProxy:(CRWWebViewProxy*)webView | 48 - (void)setWebViewProxy:(id<CRWWebViewProxy>)webView |
81 controller:(CRWWebController*)webController; | 49 controller:(CRWWebController*)webController; |
82 | 50 |
83 @end | 51 @end |
84 | 52 |
85 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_ | 53 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_ |
OLD | NEW |