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

Side by Side Diff: chrome/browser/autofill/android/personal_data_manager_android.h

Issue 1509373004: Pass method parameters as JavaParamRef in chrome/browser (part 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_
6 #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ 6 #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_
7 7
8 #include "base/android/jni_weak_ref.h" 8 #include "base/android/jni_weak_ref.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "components/autofill/core/browser/personal_data_manager.h" 10 #include "components/autofill/core/browser/personal_data_manager.h"
11 #include "components/autofill/core/browser/personal_data_manager_observer.h" 11 #include "components/autofill/core/browser/personal_data_manager_observer.h"
12 12
13 namespace autofill { 13 namespace autofill {
14 14
15 // Android wrapper of the PersonalDataManager which provides access from the 15 // Android wrapper of the PersonalDataManager which provides access from the
16 // Java layer. Note that on Android, there's only a single profile, and 16 // Java layer. Note that on Android, there's only a single profile, and
17 // therefore a single instance of this wrapper. 17 // therefore a single instance of this wrapper.
18 class PersonalDataManagerAndroid : public PersonalDataManagerObserver { 18 class PersonalDataManagerAndroid : public PersonalDataManagerObserver {
19 public: 19 public:
20 PersonalDataManagerAndroid(JNIEnv* env, jobject obj); 20 PersonalDataManagerAndroid(JNIEnv* env, jobject obj);
21 21
22 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles. 22 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles.
23 // ------------------------- 23 // -------------------------
24 24
25 // Returns the number of web and auxiliary profiles. 25 // Returns the number of web and auxiliary profiles.
26 jint GetProfileCount(JNIEnv* unused_env, jobject unused_obj); 26 jint GetProfileCount(JNIEnv* unused_env,
27 const base::android::JavaParamRef<jobject>& unused_obj);
27 28
28 // Returns the profile as indexed by |index| in the PersonalDataManager's 29 // Returns the profile as indexed by |index| in the PersonalDataManager's
29 // |GetProfiles()| collection. 30 // |GetProfiles()| collection.
30 base::android::ScopedJavaLocalRef<jobject> GetProfileByIndex( 31 base::android::ScopedJavaLocalRef<jobject> GetProfileByIndex(
31 JNIEnv* env, 32 JNIEnv* env,
32 jobject unused_obj, 33 const base::android::JavaParamRef<jobject>& unused_obj,
33 jint index); 34 jint index);
34 35
35 // Returns the profile with the specified |jguid|, or NULL if there is no 36 // Returns the profile with the specified |jguid|, or NULL if there is no
36 // profile with the specified |jguid|. Both web and auxiliary profiles may 37 // profile with the specified |jguid|. Both web and auxiliary profiles may
37 // be returned. 38 // be returned.
38 base::android::ScopedJavaLocalRef<jobject> GetProfileByGUID( 39 base::android::ScopedJavaLocalRef<jobject> GetProfileByGUID(
39 JNIEnv* env, 40 JNIEnv* env,
40 jobject unused_obj, 41 const base::android::JavaParamRef<jobject>& unused_obj,
41 jstring jguid); 42 const base::android::JavaParamRef<jstring>& jguid);
42 43
43 // Adds or modifies a profile. If |jguid| is an empty string, we are creating 44 // Adds or modifies a profile. If |jguid| is an empty string, we are creating
44 // a new profile. Else we are updating an existing profile. Always returns 45 // a new profile. Else we are updating an existing profile. Always returns
45 // the GUID for this profile; the GUID it may have just been created. 46 // the GUID for this profile; the GUID it may have just been created.
46 base::android::ScopedJavaLocalRef<jstring> SetProfile(JNIEnv* env, 47 base::android::ScopedJavaLocalRef<jstring> SetProfile(
47 jobject unused_obj, 48 JNIEnv* env,
48 jobject jprofile); 49 const base::android::JavaParamRef<jobject>& unused_obj,
50 const base::android::JavaParamRef<jobject>& jprofile);
49 51
50 // Gets the labels for all known profiles. These labels are useful for 52 // Gets the labels for all known profiles. These labels are useful for
51 // distinguishing the profiles from one another. 53 // distinguishing the profiles from one another.
52 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabels( 54 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileLabels(
53 JNIEnv* env, 55 JNIEnv* env,
54 jobject unused_obj); 56 const base::android::JavaParamRef<jobject>& unused_obj);
55 57
56 // These functions act on local credit cards. 58 // These functions act on local credit cards.
57 // -------------------- 59 // --------------------
58 60
59 // Returns the number of credit cards. 61 // Returns the number of credit cards.
60 jint GetCreditCardCount(JNIEnv* unused_env, jobject unused_obj); 62 jint GetCreditCardCount(
63 JNIEnv* unused_env,
64 const base::android::JavaParamRef<jobject>& unused_obj);
61 65
62 // Returns the credit card as indexed by |index| in the PersonalDataManager's 66 // Returns the credit card as indexed by |index| in the PersonalDataManager's
63 // |GetCreditCards()| collection. 67 // |GetCreditCards()| collection.
64 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByIndex( 68 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByIndex(
65 JNIEnv* env, 69 JNIEnv* env,
66 jobject unused_obj, 70 const base::android::JavaParamRef<jobject>& unused_obj,
67 jint index); 71 jint index);
68 72
69 // Returns the credit card with the specified |jguid|, or NULL if there is 73 // Returns the credit card with the specified |jguid|, or NULL if there is
70 // no credit card with the specified |jguid|. 74 // no credit card with the specified |jguid|.
71 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByGUID( 75 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByGUID(
72 JNIEnv* env, 76 JNIEnv* env,
73 jobject unused_obj, 77 const base::android::JavaParamRef<jobject>& unused_obj,
74 jstring jguid); 78 const base::android::JavaParamRef<jstring>& jguid);
75 79
76 // Adds or modifies a credit card. If |jguid| is an empty string, we are 80 // Adds or modifies a credit card. If |jguid| is an empty string, we are
77 // creating a new profile. Else we are updating an existing profile. Always 81 // creating a new profile. Else we are updating an existing profile. Always
78 // returns the GUID for this profile; the GUID it may have just been created. 82 // returns the GUID for this profile; the GUID it may have just been created.
79 base::android::ScopedJavaLocalRef<jstring> SetCreditCard( 83 base::android::ScopedJavaLocalRef<jstring> SetCreditCard(
80 JNIEnv* env, 84 JNIEnv* env,
81 jobject unused_obj, 85 const base::android::JavaParamRef<jobject>& unused_obj,
82 jobject jcard); 86 const base::android::JavaParamRef<jobject>& jcard);
83 87
84 // Removes the profile or credit card represented by |jguid|. 88 // Removes the profile or credit card represented by |jguid|.
85 void RemoveByGUID(JNIEnv* env, jobject unused_obj, jstring jguid); 89 void RemoveByGUID(JNIEnv* env,
90 const base::android::JavaParamRef<jobject>& unused_obj,
91 const base::android::JavaParamRef<jstring>& jguid);
86 92
87 // Resets the given unmasked card back to the masked state. 93 // Resets the given unmasked card back to the masked state.
88 void ClearUnmaskedCache(JNIEnv* env, jobject unused_obj, jstring jguid); 94 void ClearUnmaskedCache(
95 JNIEnv* env,
96 const base::android::JavaParamRef<jobject>& unused_obj,
97 const base::android::JavaParamRef<jstring>& jguid);
89 98
90 // PersonalDataManagerObserver: 99 // PersonalDataManagerObserver:
91 void OnPersonalDataChanged() override; 100 void OnPersonalDataChanged() override;
92 101
93 // Registers the JNI bindings for this class. 102 // Registers the JNI bindings for this class.
94 static bool Register(JNIEnv* env); 103 static bool Register(JNIEnv* env);
95 104
96 private: 105 private:
97 ~PersonalDataManagerAndroid() override; 106 ~PersonalDataManagerAndroid() override;
98 107
99 // Pointer to the java counterpart. 108 // Pointer to the java counterpart.
100 JavaObjectWeakGlobalRef weak_java_obj_; 109 JavaObjectWeakGlobalRef weak_java_obj_;
101 110
102 // Pointer to the PersonalDataManager for the main profile. 111 // Pointer to the PersonalDataManager for the main profile.
103 PersonalDataManager* personal_data_manager_; 112 PersonalDataManager* personal_data_manager_;
104 113
105 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); 114 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid);
106 }; 115 };
107 116
108 } // namespace autofill 117 } // namespace autofill
109 118
110 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ 119 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698