OLD | NEW |
(Empty) | |
| 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. |
| 4 #ifndef IOS_CHROME_BROWSER_AUTOFILL_AUTOFILL_AGENT_H_ |
| 5 #define IOS_CHROME_BROWSER_AUTOFILL_AUTOFILL_AGENT_H_ |
| 6 |
| 7 #import <Foundation/Foundation.h> |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/autofill/core/browser/autofill_metrics.h" |
| 12 #import "ios/chrome/browser/autofill/form_suggestion_provider.h" |
| 13 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
| 14 |
| 15 namespace autofill { |
| 16 class AutofillPopupDelegate; |
| 17 struct FormData; |
| 18 class FormStructure; |
| 19 } |
| 20 |
| 21 namespace ios { |
| 22 class ChromeBrowserState; |
| 23 } |
| 24 |
| 25 namespace web { |
| 26 class WebState; |
| 27 } |
| 28 |
| 29 // Handles autofill form suggestions. Reads forms from the page, sends them to |
| 30 // AutofillManager for metrics and to retrieve suggestions, and fills forms in |
| 31 // response to user interaction with suggestions. This is the iOS counterpart |
| 32 // to the upstream class autofill::AutofillAgent. |
| 33 @interface AutofillAgent : NSObject<FormSuggestionProvider> |
| 34 |
| 35 @property(nonatomic, readonly) ios::ChromeBrowserState* browserState; |
| 36 |
| 37 // Designated initializer. Arguments |browserState| and |webState| should not be |
| 38 // null. |
| 39 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 40 webState:(web::WebState*)webState |
| 41 NS_DESIGNATED_INITIALIZER; |
| 42 |
| 43 - (instancetype)init NS_UNAVAILABLE; |
| 44 |
| 45 // Callback by AutofillController when suggestions are ready. |
| 46 - (void)onSuggestionsReady:(NSArray*)suggestions |
| 47 popupDelegate: |
| 48 (const base::WeakPtr<autofill::AutofillPopupDelegate>&) |
| 49 delegate; |
| 50 |
| 51 // The supplied data should be filled into the form. |
| 52 - (void)onFormDataFilled:(const autofill::FormData&)result; |
| 53 |
| 54 // Detatches from the web state. |
| 55 - (void)detachFromWebState; |
| 56 |
| 57 // Renders the field type predictions specified in |forms|. This method is a |
| 58 // no-op if the relevant experiment is not enabled. |
| 59 - (void)renderAutofillTypePredictions: |
| 60 (const std::vector<autofill::FormStructure*>&)forms; |
| 61 |
| 62 @end |
| 63 |
| 64 #endif // IOS_CHROME_BROWSER_AUTOFILL_AUTOFILL_AGENT_H_ |
OLD | NEW |