Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: ios/chrome/browser/autofill/form_suggestion_controller.h

Issue 1022463002: [iOS] Upstream files in //ios/chrome/browser/autofill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/autofill/form_suggestion_controller.h
diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.h b/ios/chrome/browser/autofill/form_suggestion_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cf39c7463b40a38cdd7faf39818661478bf3bfd
--- /dev/null
+++ b/ios/chrome/browser/autofill/form_suggestion_controller.h
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_AUTOFILL_FORM_SUGGESTION_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_AUTOFILL_FORM_SUGGESTION_CONTROLLER_H_
+
+#import <UIKit/UIKit.h>
+
+#include <string>
+
+#import "components/autofill/ios/browser/js_suggestion_manager.h"
+#import "ios/chrome/browser/autofill/form_suggestion_view.h"
+#import "ios/chrome/browser/autofill/form_suggestion_view_client.h"
+#import "ios/web/public/web_state/web_state_observer_bridge.h"
+
+namespace web {
+class WebState;
+}
+
+@protocol CRWWebViewProxy;
+@protocol FormInputAccessoryViewProvider;
+
+// Handles form focus events and presents input suggestions.
+@interface FormSuggestionController
+ : NSObject<CRWWebStateObserver, FormSuggestionViewClient>
+
+// Initializes a new FormSuggestionController with the specified WebState and a
+// list of FormSuggestionProviders.
+// When suggestions are required for an input field, the |providers| will be
+// asked (in order) if they can handle the field; the first provider to return
+// YES from [FormSuggestionProvider canProviderSuggestionsForForm:field:] will
+// be expected to provide those suggestions using [FormSuggestionProvider
+// retrieveSuggestionsForForm:field:withCompletion:].
+- (instancetype)initWithWebState:(web::WebState*)webState
+ providers:(NSArray*)providers;
+
+// Instructs the controller to detach itself from the WebState.
+- (void)detachFromWebState;
+
+// Provides an input accessory view for form suggestions.
+@property(nonatomic, readonly)
+ id<FormInputAccessoryViewProvider> accessoryViewProvider;
+
+@end
+
+@interface FormSuggestionController (ForTesting)
+
+// Initializes a new controller in the same way as the public initializer, but
+// supports specifying a JsSuggestionManager for testing.
+- (instancetype)initWithWebState:(web::WebState*)webState
+ providers:(NSArray*)providers
+ JsSuggestionManager:(JsSuggestionManager*)jsSuggestionManager;
+
+// Overrides the web view proxy.
+- (void)setWebViewProxy:(id<CRWWebViewProxy>)webViewProxy;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_AUTOFILL_FORM_SUGGESTION_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698