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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_IOS_BROWSER_JS_SUGGESTION_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_IOS_BROWSER_JS_SUGGESTION_MANAGER_H_
8 #import "ios/web/public/web_state/js/crw_js_injection_manager.h"
10 @
class CRWJSInjectionReceiver
;
12 // Loads the JavaScript file, suggestion_manager.js, which contains form parsing
13 // and autofill functions.
14 @interface JsSuggestionManager
: CRWJSInjectionManager
16 // Focuses the next focusable element in tab order. No action if there is no
18 - (void)selectNextElement
;
20 // Focuses the next focusable element in tab order after the element specified
21 // by |formName| and |fieldName|. No action if there is no such element.
22 - (void)selectElementAfterForm
:(NSString
*)formName field
:(NSString
*)fieldName
;
24 // Focuses the previous focusable element in tab order. No action if there is
26 - (void)selectPreviousElement
;
28 // Focuses the previous focusable element in tab order from the element
29 // specified by |formName| and |fieldName|. No action if there is no such
31 - (void)selectElementBeforeForm
:(NSString
*)formName field
:(NSString
*)fieldName
;
33 // Injects JS to check if the page contains a next and previous element.
34 // |completionHandler| is called with 2 BOOLs, the first indicating if a
35 // previous element was found, and the second indicating if a next element was
36 // found. |completionHandler| cannot be nil.
37 - (void)fetchPreviousAndNextElementsPresenceWithCompletionHandler
:
38 (void (^)(BOOL
, BOOL
))completionHandler
;
40 // Injects JS to check if the page contains a next and previous element
41 // starting from the field specified by |formName| and |fieldName|.
42 // |completionHandler| is called with 2 BOOLs, the first indicating if a
43 // previous element was found, and the second indicating if a next element was
44 // found. |completionHandler| cannot be nil.
45 - (void)fetchPreviousAndNextElementsPresenceForForm
:(NSString
*)formName
46 field
:(NSString
*)fieldName
48 (void (^)(BOOL
, BOOL
))completionHandler
;
50 // Closes the keyboard and defocuses the active input element.
51 - (void)closeKeyboard
;
55 #endif // COMPONENTS_AUTOFILL_IOS_BROWSER_JS_SUGGESTION_MANAGER_H_