Chromium Code Reviews| 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_ANDROID_FORM_DATA_ANDROID_H_ | |
| 6 #define COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_ | |
| 7 | |
| 8 #include "base/android/jni_weak_ref.h" | |
| 9 #include "base/android/scoped_java_ref.h" | |
| 10 #include "components/autofill/core/common/form_data.h" | |
| 11 | |
| 12 namespace autofill { | |
| 13 | |
| 14 class FormFieldDataAndroid; | |
| 15 | |
| 16 // 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.
| |
| 17 // avaliable in Java. | |
|
sebsg
2017/05/24 13:32:42
typo: available
michaelbai
2017/05/26 23:12:07
Done.
| |
| 18 class FormDataAndroid { | |
| 19 public: | |
| 20 FormDataAndroid(const FormData& form); | |
| 21 virtual ~FormDataAndroid(); | |
| 22 | |
| 23 base::android::ScopedJavaLocalRef<jobject> GetJavaPeer(); | |
| 24 | |
| 25 // 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
| |
| 26 const FormData& PullAutofillValues(); | |
| 27 | |
| 28 base::android::ScopedJavaLocalRef<jobject> GetNextFormFieldData( | |
| 29 JNIEnv* env, | |
| 30 const base::android::JavaParamRef<jobject>& jcaller); | |
| 31 | |
| 32 // Get index of given field, return True and index of focus field if found. | |
| 33 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.
| |
| 34 | |
| 35 // Get index of given field, return True and index of focus field if | |
| 36 // similar field is found. | |
| 37 bool GetSimilarFieldIndex(const FormFieldData& field, size_t* index); | |
| 38 | |
| 39 // Return true if this form is similar to the given form. | |
| 40 bool SimilarFormAs(const FormData& form); | |
| 41 | |
| 42 void OnTextFieldDidChange(size_t index, const base::string16& value); | |
| 43 | |
| 44 private: | |
| 45 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
| |
| 46 std::vector<std::unique_ptr<FormFieldDataAndroid>> fields_; | |
| 47 JavaObjectWeakGlobalRef java_ref_; | |
| 48 // 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.
| |
| 49 size_t index_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(FormDataAndroid); | |
| 52 }; | |
| 53 | |
| 54 bool RegisterFormDataAndroid(JNIEnv* env); | |
| 55 | |
| 56 } // namespace autofill | |
| 57 | |
| 58 #endif // COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_ | |
| OLD | NEW |