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

Side by Side Diff: components/autofill/android/java/src/org/chromium/components/autofill/AutofillProvider.java

Issue 2745803003: autofill-try
Patch Set: autofill-try Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(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 package org.chromium.components.autofill;
6
7 import android.util.SparseArray;
8 import android.view.ViewGroup;
9 import android.view.ViewStructure;
10
11 import org.chromium.base.annotations.CalledByNative;
12 import org.chromium.base.annotations.JNINamespace;
13 import org.chromium.content_public.browser.WebContents;
14
15 /**
16 * This class defines interface of AutofillProvider, it doesn't use chrome's
17 * autofill service or suggestion UI, instead, uses third party autofill service
18 * by knowing of format structure and user's input.
19 *
20 * AutofillProvider handles one autofill session at time, each call of
21 * queryFormFieldAutofill cancels previous session and starts a new one, the
22 * calling of other methods shall associate with current session.
23 *
24 */
25 @JNINamespace("autofill")
26 public abstract class AutofillProvider {
27 public AutofillProvider() {}
28
29 /**
30 * Invoked when container view is changed.
31 *
32 * @param containerView new container view.
33 */
34 public abstract void onContainerViewChanged(ViewGroup containerView);
35
36 public abstract void setWebContents(WebContents webContents);
37
38 /**
39 * Invoked when autofill value is available, AutofillProvider shall fill the
40 * form with the provided values.
41 *
42 * @param values the array of autofill values, the key is virtual id of form
43 * field.
44 */
45 public abstract void autofill(final SparseArray<String> values);
46
47 /**
48 * Invoked when autofill service needs the form structure.
49 *
50 * @param structure see View.onProvideAutofillVirtualStructure()
51 * @param flags see View.onProvideAutofillVirtualStructure()
52 */
53 public abstract void onProvideAutoFillVirtualStructure(ViewStructure structu re, int flags);
54
55 /**
56 * Invoked when filling form is need. AutofillProvider shall ask autofill
57 * service for the values with which to fill the form.
58 *
59 * @param formData the form needs to fill.
60 * @param focus the index of focus field in formData
61 * @param x the boundary of focus field.
62 * @param y the boundary of focus field.
63 * @param width the boundary of focus field.
64 * @param height the boundary of focus field.
65 */
66 @CalledByNative
67 protected abstract void startAutofillSession(
68 FormData formData, float focus, float x, float y, float width, float height);
69
70 /**
71 * Invoked when text field is changed.
72 *
73 * @param index index of field in current form.
74 */
75 @CalledByNative
76 protected abstract void onTextFieldDidChange(int index);
77
78 /**
79 * Invoked when current form will be submitted.
80 *
81 */
82 @CalledByNative
83 protected abstract void onWillSubmitForm();
84
85 /**
86 * Invoked when focus field changed.
87 *
88 * @param focusOnForm whether focus is still on form.
89 * @param focusItem the index of field has focus
90 * @param x the boundary of focus field.
91 * @param y the boundary of focus field.
92 * @param width the boundary of focus field.
93 * @param height the boundary of focus field.
94 */
95 @CalledByNative
96 protected abstract void onFocusChanged(
97 boolean focusOnForm, int focusItem, float x, float y, float width, f loat height);
98
99 /**
100 * Send form to renderer for filling.
101 *
102 * @param nativeAutofillProvider the native autofill provider.
103 * @param formData the form to fill.
104 */
105 protected void autofill(long nativeAutofillProvider, FormData formData) {
106 nativeOnAutofillAvailable(nativeAutofillProvider, formData);
107 }
108
109 /**
110 * Invoked when current query need to be reset.
111 */
112 @CalledByNative
113 protected abstract void reset();
114
115 @CalledByNative
116 protected abstract void setNativeAutofillProvider(long nativeAutofillProvide r);
117
118 private native void nativeOnAutofillAvailable(
119 long nativeAutofillProviderAndroid, FormData formData);
120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698