| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ |
| 6 #define COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/ios/block_types.h" | 8 #include "base/ios/block_types.h" |
| 9 #include "components/autofill/core/common/autofill_constants.h" | 9 #include "components/autofill/core/common/autofill_constants.h" |
| 10 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" | 10 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| 11 | 11 |
| 12 @class CRWJSInjectionReceiver; | 12 @class CRWJSInjectionReceiver; |
| 13 | 13 |
| 14 // Loads the JavaScript file, autofill_controller.js, which contains form | 14 // Loads the JavaScript file, autofill_controller.js, which contains form |
| 15 // parsing and autofill functions. | 15 // parsing and autofill functions. |
| 16 @interface JsAutofillManager : CRWJSInjectionManager | 16 @interface JsAutofillManager : CRWJSInjectionManager |
| 17 | 17 |
| 18 // Extracts forms from a web page. Only forms with at least |requiredFields| | 18 // Extracts forms from a web page. Only forms with at least |requiredFields| |
| 19 // fields and the appropriate attribute requirements are extracted. | 19 // fields and the appropriate attribute requirements are extracted. |
| 20 // |completionHandler| is called with the JSON string of forms of a web page. | 20 // |completionHandler| is called with the JSON string of forms of a web page. |
| 21 // |completionHandler| cannot be nil. | 21 // |completionHandler| cannot be nil. |
| 22 - (void)fetchFormsWithRequirements:(autofill::RequirementsMask)requirements | 22 - (void)fetchFormsWithRequirements:(autofill::RequirementsMask)requirements |
| 23 minimumRequiredFieldsCount:(NSUInteger)requiredFieldsCount | 23 minimumRequiredFieldsCount:(NSUInteger)requiredFieldsCount |
| 24 completionHandler:(void (^)(NSString*))completionHandler; | 24 completionHandler:(void (^)(NSString*))completionHandler; |
| 25 | 25 |
| 26 // Stores the current active element. This is used to make the element active |
| 27 // again in case the web view loses focus when a dialog is presented over it. |
| 28 - (void)storeActiveElement; |
| 29 |
| 26 // Fills the data in JSON string |dataString| into the active form field, then | 30 // Fills the data in JSON string |dataString| into the active form field, then |
| 27 // executes the |completionHandler|. | 31 // executes the |completionHandler|. |
| 28 - (void)fillActiveFormField:(NSString*)dataString | 32 - (void)fillActiveFormField:(NSString*)dataString |
| 29 completionHandler:(ProceduralBlock)completionHandler; | 33 completionHandler:(ProceduralBlock)completionHandler; |
| 30 | 34 |
| 31 // Fills a number of fields in the same named form. | 35 // Fills a number of fields in the same named form. |
| 32 // |completionHandler| is called after the forms are filled. |completionHandler| | 36 // |completionHandler| is called after the forms are filled. |completionHandler| |
| 33 // cannot be nil. | 37 // cannot be nil. |
| 34 - (void)fillForm:(NSString*)dataString | 38 - (void)fillForm:(NSString*)dataString |
| 35 completionHandler:(ProceduralBlock)completionHandler; | 39 completionHandler:(ProceduralBlock)completionHandler; |
| 36 | 40 |
| 37 // Dispatches the autocomplete event to the form element with the given | 41 // Dispatches the autocomplete event to the form element with the given |
| 38 // |formName|. | 42 // |formName|. |
| 39 - (void)dispatchAutocompleteEvent:(NSString*)formName; | 43 - (void)dispatchAutocompleteEvent:(NSString*)formName; |
| 40 | 44 |
| 41 // Dispatches the autocomplete error event to the form element with the given | 45 // Dispatches the autocomplete error event to the form element with the given |
| 42 // |formName|, supplying the given reason. | 46 // |formName|, supplying the given reason. |
| 43 - (void)dispatchAutocompleteErrorEvent:(NSString*)formName | 47 - (void)dispatchAutocompleteErrorEvent:(NSString*)formName |
| 44 withReason:(NSString*)reason; | 48 withReason:(NSString*)reason; |
| 45 | 49 |
| 46 // Marks up the form with autofill field prediction data (diagnostic tool). | 50 // Marks up the form with autofill field prediction data (diagnostic tool). |
| 47 - (void)fillPredictionData:(NSString*)dataString; | 51 - (void)fillPredictionData:(NSString*)dataString; |
| 48 | 52 |
| 49 @end | 53 @end |
| 50 | 54 |
| 51 #endif // COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ | 55 #endif // COMPONENTS_AUTOFILL_IOS_BROWSER_JS_AUTOFILL_MANAGER_H_ |
| OLD | NEW |