OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_AUTOFILL_BROWSER_ANDROID_AUXILIARY_PROFILE_LOADER_ANDROID_H_ | |
6 #define COMPONENTS_AUTOFILL_BROWSER_ANDROID_AUXILIARY_PROFILE_LOADER_ANDROID_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/android/jni_android.h" | |
11 #include "base/string16.h" | |
12 | |
13 namespace autofill { | |
14 | |
15 bool RegisterAuxiliaryProfileLoader(JNIEnv* env); | |
16 | |
17 // This class loads user's contact information from their device. | |
18 // The populated data corresponds to the user's 'Me' profile in their | |
19 // contact list. | |
20 class AuxiliaryProfileLoaderAndroid { | |
21 public: | |
22 AuxiliaryProfileLoaderAndroid(); | |
23 virtual ~AuxiliaryProfileLoaderAndroid(); | |
24 | |
25 // Init method should be called after object initialization. | |
26 // context parameter is an Android context. | |
27 void Init(JNIEnv* env, const jobject& context); | |
28 | |
29 // Returns address street. | |
30 virtual string16 GetStreet() const; | |
31 // Returns address post office box. | |
32 virtual string16 GetPostOfficeBox() const; | |
33 // Returns address neighborhood (e.g. Noe Valley, Nob Hill, Twin Peaks, ...). | |
34 virtual string16 GetNeighborhood() const; | |
35 // Returns address region such as state or province information | |
36 // (e.g. Ontario, California, Hubei). | |
37 virtual string16 GetRegion() const; | |
38 // Returns address city. | |
39 virtual string16 GetCity() const; | |
40 // Returns address postal code or zip code. | |
41 virtual string16 GetPostalCode() const; | |
42 // Returns address country. | |
43 virtual string16 GetCountry() const; | |
44 | |
45 // Returns contact's first name. | |
46 virtual string16 GetFirstName() const; | |
47 // Returns contact's middle name. | |
48 virtual string16 GetMiddleName() const; | |
49 // Returns contact's last name. | |
50 virtual string16 GetLastName() const; | |
51 // Returns contact's suffix (e.g. Ph.D, M.D., ...). | |
52 virtual string16 GetSuffix() const; | |
53 | |
54 // Populates string vector parameter with contact's email addresses. | |
55 virtual void GetEmailAddresses(std::vector<string16>* email_addresses) const; | |
56 | |
57 // Populates string vector parameter with contact's phones numbers. | |
58 virtual void GetPhoneNumbers(std::vector<string16>* phone_numbers) const; | |
59 | |
60 private: | |
61 JNIEnv* env_; | |
Yaron
2013/03/16 00:15:30
Hmm. We generally don't cache the env pointer or a
apiccion
2013/03/18 19:30:36
Thanks. I will keep this in mind for the future.
| |
62 // The reference to java |PersonalAutofillPopulator| which | |
63 // actually extracts users contact information from the physical device | |
64 base::android::ScopedJavaLocalRef<jobject> populator_; | |
65 DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfileLoaderAndroid); | |
66 }; | |
67 | |
68 } // namespace | |
69 | |
70 #endif // COMPONENTS_AUTOFILL_BROWSER_ANDROID_AUXILIARY_PROFILE_LOADER_ANDROID_ H_ | |
OLD | NEW |