| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 |
| 5 #ifndef COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_ |
| 6 #define COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_ |
| 7 |
| 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/autofill/core/browser/autofill_provider.h" |
| 11 |
| 12 namespace content { |
| 13 class WebContents; |
| 14 } |
| 15 |
| 16 namespace autofill { |
| 17 |
| 18 class FormDataAndroid; |
| 19 |
| 20 class AutofillProviderAndroid : public AutofillProvider { |
| 21 public: |
| 22 AutofillProviderAndroid( |
| 23 const base::android::ScopedJavaLocalRef<jobject>& jcaller, |
| 24 content::WebContents* web_contents); |
| 25 virtual ~AutofillProviderAndroid(); |
| 26 |
| 27 void setNewWebContents(); |
| 28 // Override AutofillProvider methods |
| 29 void OnQueryFormFieldAutofill(AutofillManager* manager, |
| 30 int32_t id, |
| 31 const FormData& form, |
| 32 const FormFieldData& field, |
| 33 const gfx::RectF& bounding_box) override; |
| 34 |
| 35 void OnTextFieldDidChange(AutofillManager* manager, |
| 36 const FormData& form, |
| 37 const FormFieldData& field, |
| 38 const base::TimeTicks& timestamp) override; |
| 39 |
| 40 void OnWillSubmitForm(AutofillManager* manager, |
| 41 const FormData& form, |
| 42 const base::TimeTicks& timestamp) override; |
| 43 |
| 44 void OnFocusNoLongerOnForm(AutofillManager* manager) override; |
| 45 |
| 46 void OnDidFillAutofillFormData(AutofillManager* manager, |
| 47 const FormData& form, |
| 48 base::TimeTicks timestamp) override; |
| 49 |
| 50 void Reset(AutofillManager* manager) override; |
| 51 |
| 52 // Methods called by Java. |
| 53 void OnAutofillAvailable(JNIEnv* env, jobject jcaller, jobject formData); |
| 54 |
| 55 private: |
| 56 void OnFocusChanged(bool focus_on_form, |
| 57 size_t index, |
| 58 const gfx::RectF& bounding_box); |
| 59 |
| 60 bool ValidateManager(AutofillManager* manager); |
| 61 |
| 62 int32_t id_; |
| 63 std::unique_ptr<FormDataAndroid> form_; |
| 64 base::WeakPtr<AutofillManager> manager_; |
| 65 JavaObjectWeakGlobalRef java_ref_; |
| 66 content::WebContents* web_contents_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(AutofillProviderAndroid); |
| 69 }; |
| 70 |
| 71 bool RegisterAutofillProvider(JNIEnv* env); |
| 72 |
| 73 } // namespace autofill |
| 74 |
| 75 #endif // COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_ |
| OLD | NEW |