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

Side by Side Diff: components/autofill/android/form_data_android.h

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 #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, to make autofill::FormData
17 // available in Java.
18 class FormDataAndroid {
19 public:
20 FormDataAndroid(const FormData& form);
21 virtual ~FormDataAndroid();
22
23 base::android::ScopedJavaLocalRef<jobject> GetJavaPeer();
24
25 // Get autofill values from Java side and return FormData.
26 const FormData& GetAutofillValues();
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);
34
35 // Get index of given field, return True and index of focus field if
36 // similar field is found. This method compares less attributes than
37 // GetFieldIndex() does, and should be used when field could be changed
38 // dynamically, but the changed has no impact on autofill purpose, e.g. css
39 // style change, see FormFieldData::SimilarFieldAs() for details.
40 bool GetSimilarFieldIndex(const FormFieldData& field, size_t* index);
41
42 // Return true if this form is similar to the given form.
43 bool SimilarFormAs(const FormData& form);
44
45 // Invoked when form field which specified by |index| is charged to new
46 // |value|.
47 void OnTextFieldDidChange(size_t index, const base::string16& value);
48
49 private:
50 FormData form_;
51 std::vector<std::unique_ptr<FormFieldDataAndroid>> fields_;
52 JavaObjectWeakGlobalRef java_ref_;
53 // keep track of index when popping up fields to Java.
54 size_t index_;
55
56 DISALLOW_COPY_AND_ASSIGN(FormDataAndroid);
57 };
58
59 bool RegisterFormDataAndroid(JNIEnv* env);
60
61 } // namespace autofill
62
63 #endif // COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_
OLDNEW
« no previous file with comments | « components/autofill/android/autofill_provider_android.cc ('k') | components/autofill/android/form_data_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698