Chromium Code Reviews| Index: components/autofill/android/form_data_android.h |
| diff --git a/components/autofill/android/form_data_android.h b/components/autofill/android/form_data_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4b1f7fa632fb646d355d34f1ca1863846b862580 |
| --- /dev/null |
| +++ b/components/autofill/android/form_data_android.h |
| @@ -0,0 +1,58 @@ |
| +// 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_FORM_DATA_ANDROID_H_ |
| +#define COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_ |
| + |
| +#include "base/android/jni_weak_ref.h" |
| +#include "base/android/scoped_java_ref.h" |
| +#include "components/autofill/core/common/form_data.h" |
| + |
| +namespace autofill { |
| + |
| +class FormFieldDataAndroid; |
| + |
| +// This class is native peer of FormData.java, make autofill::FormData |
|
Mathieu
2017/05/24 18:02:02
*to make
michaelbai
2017/05/26 23:12:07
Done.
|
| +// avaliable in Java. |
|
sebsg
2017/05/24 13:32:42
typo: available
michaelbai
2017/05/26 23:12:07
Done.
|
| +class FormDataAndroid { |
| + public: |
| + FormDataAndroid(const FormData& form); |
| + virtual ~FormDataAndroid(); |
| + |
| + base::android::ScopedJavaLocalRef<jobject> GetJavaPeer(); |
| + |
| + // Pull autofill values from Java side and return FormData. |
|
Mathieu
2017/05/24 18:02:01
"Pull" seems odd because your are simply returning
michaelbai
2017/05/26 23:12:07
It actually get data from Java side, changed to Ge
|
| + const FormData& PullAutofillValues(); |
| + |
| + base::android::ScopedJavaLocalRef<jobject> GetNextFormFieldData( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& jcaller); |
| + |
| + // Get index of given field, return True and index of focus field if found. |
| + bool GetFieldIndex(const FormFieldData& field, size_t* index); |
|
Mathieu
2017/05/24 18:02:02
Why do both GetFieldIndex and GetSimilarFieldIndex
michaelbai
2017/05/26 23:12:07
Done.
|
| + |
| + // Get index of given field, return True and index of focus field if |
| + // similar field is found. |
| + bool GetSimilarFieldIndex(const FormFieldData& field, size_t* index); |
| + |
| + // Return true if this form is similar to the given form. |
| + bool SimilarFormAs(const FormData& form); |
| + |
| + void OnTextFieldDidChange(size_t index, const base::string16& value); |
| + |
| + private: |
| + FormData form_; |
|
Mathieu
2017/05/24 18:02:02
should you subclass FormData instead?
michaelbai
2017/05/26 23:12:07
No, I don't think so, FormData is structure, but t
|
| + std::vector<std::unique_ptr<FormFieldDataAndroid>> fields_; |
| + JavaObjectWeakGlobalRef java_ref_; |
| + // index to popup fields to Java. |
|
Mathieu
2017/05/24 18:02:02
this is unclear..
// Used to keep track of <blah>
michaelbai
2017/05/26 23:12:07
Done.
|
| + size_t index_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FormDataAndroid); |
| +}; |
| + |
| +bool RegisterFormDataAndroid(JNIEnv* env); |
| + |
| +} // namespace autofill |
| + |
| +#endif // COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_ |