cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / autofill / form_input_accessory_view_controller.h
blobbd9226c9e1ed5e417e2bcef292ab42e84cd27b3d
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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_
8 #import <UIKit/UIKit.h>
10 #import "ios/chrome/browser/autofill/form_input_accessory_view_delegate.h"
11 #import "ios/web/public/web_state/web_state_observer_bridge.h"
13 @protocol CRWWebViewProxy;
15 namespace autofill {
16 extern NSString* const kFormSuggestionAssistButtonPreviousElement;
17 extern NSString* const kFormSuggestionAssistButtonNextElement;
18 extern NSString* const kFormSuggestionAssistButtonDone;
19 extern CGFloat const kInputAccessoryHeight;
20 } // namespace autofill
22 @protocol FormInputAccessoryViewProvider;
23 @class FormInputAccessoryViewController;
25 // Block type to indicate that a FormInputAccessoryViewProvider has an accessory
26 // view to provide.
27 typedef void (^AccessoryViewAvailableCompletion)(
28 BOOL inputAccessoryViewAvailable);
30 // Block type to provide an accessory view asynchronously.
31 typedef void (^AccessoryViewReadyCompletion)(
32 UIView* view,
33 id<FormInputAccessoryViewProvider> provider);
35 // Represents an object that can provide a custom keyboard input accessory view.
36 @protocol FormInputAccessoryViewProvider<NSObject>
38 // A delegate for form navigation.
39 @property(nonatomic, assign)
40 id<FormInputAccessoryViewDelegate> accessoryViewDelegate;
42 // Determines asynchronously if this provider has a view available for the
43 // specified form/field and invokes |completionHandler| with the answer.
44 - (void)
45 checkIfAccessoryViewIsAvailableForFormNamed:(const std::string&)formName
46 fieldName:(const std::string&)fieldName
47 webState:(web::WebState*)webState
48 completionHandler:
49 (AccessoryViewAvailableCompletion)
50 completionHandler;
52 // Asynchronously retrieves an accessory view from this provider for the
53 // specified form/field and returns it via |accessoryViewUpdateBlock|.
54 - (void)retrieveAccessoryViewForFormNamed:(const std::string&)formName
55 fieldName:(const std::string&)fieldName
56 value:(const std::string&)value
57 type:(const std::string&)type
58 webState:(web::WebState*)webState
59 accessoryViewUpdateBlock:
60 (AccessoryViewReadyCompletion)accessoryViewUpdateBlock;
62 // Notifies this provider that the accessory view is going away.
63 - (void)inputAccessoryViewControllerDidReset:
64 (FormInputAccessoryViewController*)controller;
66 // Notifies this provider that the accessory view frame is changing. If the
67 // view provided by this provider needs to change, the updated view should be
68 // set using |accessoryViewUpdateBlock|.
69 - (void)resizeAccessoryView;
71 // Returns YES if UMA metrics for keyboard accessory button presses should be
72 // logged for this provider.
73 - (BOOL)getLogKeyboardAccessoryMetrics;
75 @end
77 // Creates and manages a custom input accessory view while the user is
78 // interacting with a form. Also handles hiding and showing the default
79 // accessory view elements.
80 @interface FormInputAccessoryViewController
81 : NSObject<CRWWebStateObserver, FormInputAccessoryViewDelegate>
83 // Initializes a new controller with the specified |providers| of input
84 // accessory views.
85 - (instancetype)initWithWebState:(web::WebState*)webState
86 providers:(NSArray*)providers;
88 // Notifies the controller that the owning tab was shown.
89 - (void)wasShown;
91 // Notifies the controller that the owning tab was hidden.
92 - (void)wasHidden;
94 // Hides the default input accessory view and replaces it with one that shows
95 // |customView| and form navigation controls.
96 - (void)showCustomInputAccessoryView:(UIView*)customView;
98 // Restores the default input accessory view, removing (if necessary) any
99 // previously-added custom view.
100 - (void)restoreDefaultInputAccessoryView;
102 @end
104 #endif // IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_