Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: components/autofill/android/autofill_provider_android.h

Issue 2839023003: WebView autofill implementation (Closed)
Patch Set: Refactoring AutofillManager Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/android/autofill_provider_android.h
diff --git a/components/autofill/android/autofill_provider_android.h b/components/autofill/android/autofill_provider_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..be06fdfc58966f5ebe51e49c4604a8102a73fcbc
--- /dev/null
+++ b/components/autofill/android/autofill_provider_android.h
@@ -0,0 +1,73 @@
+// 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_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_
+#define COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_
+
+#include "base/android/jni_weak_ref.h"
+#include "base/memory/weak_ptr.h"
+#include "components/autofill/core/browser/autofill_provider.h"
+
+namespace content {
+class WebContents;
+}
+
+namespace autofill {
+
+class FormDataAndroid;
+
+class AutofillProviderAndroid : public AutofillProvider {
Mathieu 2017/05/24 18:02:01 Is this only used for WebView? if so, perhaps if s
Mathieu 2017/05/24 18:02:01 Can you add a class comment, detailing who owns th
michaelbai 2017/05/24 20:57:54 No, Chrome will also use this in future.
michaelbai 2017/05/26 23:12:07 Done.
Roger McFarlane (Chromium) 2017/05/31 18:33:23 More details, plz. In what capacity?
michaelbai 2017/05/31 21:05:54 I don't have detail to put, but will definitely in
+ public:
+ AutofillProviderAndroid(const base::android::JavaRef<jobject>& jcaller,
+ content::WebContents* web_contents);
+ ~AutofillProviderAndroid() override;
+
+ // Override AutofillProvider methods
sebsg 2017/05/24 13:32:42 The usual syntax is // AutofillProvider: and th
michaelbai 2017/05/26 23:12:07 Done.
+ void OnQueryFormFieldAutofill(AutofillHandlerProxy* handler,
+ int32_t id,
+ const FormData& form,
+ const FormFieldData& field,
+ const gfx::RectF& bounding_box) override;
+
Mathieu 2017/05/24 18:02:01 nit: no need for extra lines in this "override" se
michaelbai 2017/05/26 23:12:07 Done.
+ void OnTextFieldDidChange(AutofillHandlerProxy* handler,
+ const FormData& form,
+ const FormFieldData& field,
+ const base::TimeTicks& timestamp) override;
+
+ void OnWillSubmitForm(AutofillHandlerProxy* handler,
+ const FormData& form,
+ const base::TimeTicks& timestamp) override;
+
+ void OnFocusNoLongerOnForm(AutofillHandlerProxy* handler) override;
+
+ void OnDidFillAutofillFormData(AutofillHandlerProxy* handler,
+ const FormData& form,
+ base::TimeTicks timestamp) override;
+
+ void Reset(AutofillHandlerProxy* handler) override;
+
+ // Methods called by Java.
+ void OnAutofillAvailable(JNIEnv* env, jobject jcaller, jobject formData);
Mathieu 2017/05/24 18:02:01 hacker case everywhere: form_data
michaelbai 2017/05/26 23:12:07 Done.
+
+ private:
+ void OnFocusChanged(bool focus_on_form,
+ size_t index,
+ const gfx::RectF& bounding_box);
+
+ bool ValidateHandler(AutofillHandlerProxy* handler);
+
+ int32_t id_;
+ std::unique_ptr<FormDataAndroid> form_;
+ base::WeakPtr<AutofillHandlerProxy> handler_;
+ JavaObjectWeakGlobalRef java_ref_;
+ content::WebContents* web_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutofillProviderAndroid);
+};
+
+bool RegisterAutofillProvider(JNIEnv* env);
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698