| Index: components/autofill/android/java/src/org/chromium/components/autofill/FormData.java
|
| diff --git a/components/autofill/android/java/src/org/chromium/components/autofill/FormData.java b/components/autofill/android/java/src/org/chromium/components/autofill/FormData.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d7b8bb00f74785afe9f8713d0361668a442db7fd
|
| --- /dev/null
|
| +++ b/components/autofill/android/java/src/org/chromium/components/autofill/FormData.java
|
| @@ -0,0 +1,52 @@
|
| +// 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.
|
| +
|
| +package org.chromium.components.autofill;
|
| +
|
| +import org.chromium.base.annotations.CalledByNative;
|
| +import org.chromium.base.annotations.JNINamespace;
|
| +
|
| +import java.util.ArrayList;
|
| +
|
| +/**
|
| + * The wrap class of native autofill::FormData.
|
| + */
|
| +@JNINamespace("autofill")
|
| +public class FormData {
|
| + public final String mName;
|
| + public final String mOrigin;
|
| + public final ArrayList<FormFieldData> mFields;
|
| +
|
| + private long mNativeObj;
|
| +
|
| + @CalledByNative
|
| + private static FormData createFormData(
|
| + long nativeObj, String name, String origin, int fieldCount) {
|
| + return new FormData(nativeObj, name, origin, fieldCount);
|
| + }
|
| +
|
| + private FormData(long nativeObj, String name, String origin, int fieldCount) {
|
| + mNativeObj = nativeObj;
|
| + mName = name;
|
| + mOrigin = origin;
|
| + mFields = new ArrayList<FormFieldData>(fieldCount);
|
| + popupFormFields(fieldCount);
|
| + }
|
| +
|
| + private void popupFormFields(int fieldCount) {
|
| + FormFieldData formFieldData = nativeGetNextFormFieldData(mNativeObj);
|
| + while (formFieldData != null) {
|
| + mFields.add(formFieldData);
|
| + formFieldData = nativeGetNextFormFieldData(mNativeObj);
|
| + }
|
| + assert mFields.size() == fieldCount;
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void onNativeDestroyed() {
|
| + mNativeObj = 0;
|
| + }
|
| +
|
| + private native FormFieldData nativeGetNextFormFieldData(long nativeFormDataAndroid);
|
| +}
|
|
|