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