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

Unified Diff: chrome/browser/autofill/android/personal_data_manager_android.h

Issue 2039493002: Reland of [Autofill] Sort profiles and credit cards by frecency in PaymentRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/android/personal_data_manager_android.h
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.h b/chrome/browser/autofill/android/personal_data_manager_android.h
index d618f4da42fa788862c1aadd461d9f50c7740186..a6df86fc1905ed271a2f38558f1e9ac3e58907f2 100644
--- a/chrome/browser/autofill/android/personal_data_manager_android.h
+++ b/chrome/browser/autofill/android/personal_data_manager_android.h
@@ -23,16 +23,16 @@
// These functions act on "web profiles" aka "LOCAL_PROFILE" profiles.
// -------------------------
- // Returns the number of web and auxiliary profiles.
- jint GetProfileCount(JNIEnv* unused_env,
- const base::android::JavaParamRef<jobject>& unused_obj);
+ // Returns the GUIDs of all profiles.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDsForSettings(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& unused_obj);
- // Returns the profile as indexed by |index| in the PersonalDataManager's
- // |GetProfiles()| collection.
- base::android::ScopedJavaLocalRef<jobject> GetProfileByIndex(
+ // Returns the GUIDs of the profiles to suggest to the user. See
+ // PersonalDataManager::GetProfilesToSuggest for more details.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDsToSuggest(
JNIEnv* env,
- const base::android::JavaParamRef<jobject>& unused_obj,
- jint index);
+ const base::android::JavaParamRef<jobject>& unused_obj);
// Returns the profile with the specified |jguid|, or NULL if there is no
// profile with the specified |jguid|. Both web and auxiliary profiles may
@@ -54,28 +54,33 @@
// distinguishing the profiles from one another.
//
// The labels never contain the full name and include at least 2 fields.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabelsForSettings(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& unused_obj);
+
+ // Gets the labels for the profiles to suggest to the user. These labels are
+ // useful for distinguishing the profiles from one another.
//
- // If |address_only| is true, then such fields as phone number and email
- // address are also omitted, but all fields are included in the label.
- base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabels(
+ // The labels never contain the full name. Fields such as phone number and
+ // email address are also omitted, but all other fields are included in the
+ // label.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabelsToSuggest(
JNIEnv* env,
- const base::android::JavaParamRef<jobject>& unused_obj,
- bool address_only);
+ const base::android::JavaParamRef<jobject>& unused_obj);
// These functions act on local credit cards.
// --------------------
- // Returns the number of credit cards.
- jint GetCreditCardCount(
- JNIEnv* unused_env,
+ // Returns the GUIDs of all the credit cards.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDsForSettings(
+ JNIEnv* env,
const base::android::JavaParamRef<jobject>& unused_obj);
- // Returns the credit card as indexed by |index| in the PersonalDataManager's
- // |GetCreditCards()| collection.
- base::android::ScopedJavaLocalRef<jobject> GetCreditCardByIndex(
+ // Returns the GUIDs of the credit cards to suggest to the user. See
+ // PersonalDataManager::GetCreditCardsToSuggest for more details.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDsToSuggest(
JNIEnv* env,
- const base::android::JavaParamRef<jobject>& unused_obj,
- jint index);
+ const base::android::JavaParamRef<jobject>& unused_obj);
// Returns the credit card with the specified |jguid|, or NULL if there is
// no credit card with the specified |jguid|.
@@ -123,8 +128,54 @@
// Registers the JNI bindings for this class.
static bool Register(JNIEnv* env);
+ // Sets the use count and use date of the profile associated to the |jguid|.
+ // Both |count| and |date| should be non-negative. |date| represents an
+ // absolute point in coordinated universal time (UTC) represented as
+ // microseconds since the Windows epoch. For more details see the comment
+ // header in time.h.
+ void SetProfileUseStatsForTesting(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& unused_obj,
+ const base::android::JavaParamRef<jstring>& jguid,
+ jint count,
+ jint date);
+
+ // Sets the use count and use date of the credit card associated to the
+ // |jguid|. Both |count| and |date| should be non-negative. |date| represents
+ // an absolute point in coordinated universal time (UTC) represented as
+ // microseconds since the Windows epoch. For more details see the comment
+ // header in time.h.
+ void SetCreditCardUseStatsForTesting(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& unused_obj,
+ const base::android::JavaParamRef<jstring>& jguid,
+ jint count,
+ jint date);
+
private:
~PersonalDataManagerAndroid() override;
+
+ // Returns the GUIDs of the |profiles| passed as parameter.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs(
+ JNIEnv* env,
+ const std::vector<AutofillProfile*>& profiles);
+
+ // Returns the GUIDs of the |credit_cards| passed as parameter.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs(
+ JNIEnv* env,
+ const std::vector<CreditCard*>& credit_cards);
+
+ // Gets the labels for the |profiles| passed as parameters. These labels are
+ // useful for distinguishing the profiles from one another.
+ //
+ // The labels never contain the full name and include at least 2 fields.
+ //
+ // If |address_only| is true, then such fields as phone number and email
+ // address are also omitted, but all fields are included in the label.
+ base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabels(
+ JNIEnv* env,
+ bool address_only,
+ std::vector<AutofillProfile*> profiles);
// Pointer to the java counterpart.
JavaObjectWeakGlobalRef weak_java_obj_;

Powered by Google App Engine
This is Rietveld 408576698