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_CONTENT_BROWSER_AUTOFILL_DRIVER_IOS_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IOS_H_
10 #include "components/autofill/core/browser/autofill_client.h"
11 #include "components/autofill/core/browser/autofill_driver.h"
12 #include "components/autofill/core/browser/autofill_external_delegate.h"
13 #include "components/autofill/core/browser/autofill_manager.h"
14 #include "ios/web/public/web_state/web_state_user_data.h"
20 @protocol AutofillDriverIOSBridge
;
24 class AutofillManagerDelegate
;
26 // Class that drives autofill flow on iOS. There is one instance per
28 class AutofillDriverIOS
: public AutofillDriver
,
29 public web::WebStateUserData
<AutofillDriverIOS
> {
31 static void CreateForWebStateAndDelegate(
32 web::WebState
* web_state
,
33 AutofillClient
* client
,
34 id
<AutofillDriverIOSBridge
> bridge
,
35 const std::string
& app_locale
,
36 AutofillManager::AutofillDownloadManagerState enable_download_manager
);
39 bool IsOffTheRecord() const override
;
40 net::URLRequestContextGetter
* GetURLRequestContext() override
;
41 bool RendererIsAvailable() override
;
42 void SendFormDataToRenderer(int query_id
,
43 RendererFormDataAction action
,
44 const FormData
& data
) override
;
45 void PingRenderer() override
;
46 void DetectAccountCreationForms(
47 const std::vector
<autofill::FormStructure
*>& forms
) override
;
48 void SendAutofillTypePredictionsToRenderer(
49 const std::vector
<FormStructure
*>& forms
) override
;
50 void RendererShouldClearFilledForm() override
;
51 void RendererShouldClearPreviewedForm() override
;
52 void RendererShouldAcceptDataListSuggestion(
53 const base::string16
& value
) override
;
54 base::SequencedWorkerPool
* GetBlockingPool() override
;
56 AutofillManager
* autofill_manager() { return &autofill_manager_
; }
58 void RendererShouldFillFieldWithValue(const base::string16
& value
) override
;
59 void RendererShouldPreviewFieldWithValue(
60 const base::string16
& value
) override
;
61 void PopupHidden() override
;
65 web::WebState
* web_state
,
66 AutofillClient
* client
,
67 id
<AutofillDriverIOSBridge
> bridge
,
68 const std::string
& app_locale
,
69 AutofillManager::AutofillDownloadManagerState enable_download_manager
);
70 ~AutofillDriverIOS() override
;
72 // The WebState with which this object is associated.
73 web::WebState
* web_state_
;
75 // AutofillDriverIOSBridge instance that is passed in.
76 id
<AutofillDriverIOSBridge
> bridge_
;
78 // AutofillManager instance via which this object drives the shared Autofill
80 AutofillManager autofill_manager_
;
81 // AutofillExternalDelegate instance that is passed to the AutofillManager.
82 AutofillExternalDelegate autofill_external_delegate_
;
85 } // namespace autofill
87 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IOS_H_