summaryrefslogtreecommitdiff
path: root/chromium/components/autofill/core/browser/autofill_provider.h
blob: cb986feb4bfa88c6dac2824a598be4e66589533d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2017 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROVIDER_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROVIDER_H_

#include "base/time/time.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/submission_source.h"

namespace gfx {
class RectF;
}

namespace autofill {

class AutofillHandlerProxy;

// This class defines the interface for the autofill implementation other than
// default AutofillManager.
class AutofillProvider {
 public:
  AutofillProvider();
  virtual ~AutofillProvider();

  virtual void OnQueryFormFieldAutofill(AutofillHandlerProxy* handler,
                                        int32_t id,
                                        const FormData& form,
                                        const FormFieldData& field,
                                        const gfx::RectF& bounding_box) = 0;

  virtual void OnTextFieldDidChange(AutofillHandlerProxy* handler,
                                    const FormData& form,
                                    const FormFieldData& field,
                                    const gfx::RectF& bounding_box,
                                    const base::TimeTicks timestamp) = 0;

  virtual void OnTextFieldDidScroll(AutofillHandlerProxy* handler,
                                    const FormData& form,
                                    const FormFieldData& field,
                                    const gfx::RectF& bounding_box) = 0;

  virtual void OnSelectControlDidChange(AutofillHandlerProxy* handler,
                                        const FormData& form,
                                        const FormFieldData& field,
                                        const gfx::RectF& bounding_box) = 0;

  virtual bool OnFormSubmitted(AutofillHandlerProxy* handler,
                               const FormData& form,
                               bool known_success,
                               SubmissionSource source,
                               base::TimeTicks timestamp) = 0;

  virtual void OnFocusNoLongerOnForm(AutofillHandlerProxy* handler) = 0;

  virtual void OnFocusOnFormField(AutofillHandlerProxy* handler,
                                  const FormData& form,
                                  const FormFieldData& field,
                                  const gfx::RectF& bounding_box) = 0;

  virtual void OnDidFillAutofillFormData(AutofillHandlerProxy* handler,
                                         const FormData& form,
                                         base::TimeTicks timestamp) = 0;

  virtual void OnFormsSeen(AutofillHandlerProxy* handler,
                           const std::vector<FormData>& forms,
                           const base::TimeTicks timestamp) = 0;

  virtual void Reset(AutofillHandlerProxy* handler) = 0;

  void SendFormDataToRenderer(AutofillHandlerProxy* handler,
                              int requestId,
                              const FormData& formData);
};

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROVIDER_H_