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 true IFF the application has priviledges to access the user's |
| 30 // contact information. |
| 31 virtual bool GetHasPermissions() const; |
| 32 // Returns address street. |
| 33 virtual string16 GetStreet() const; |
| 34 // Returns address post office box. |
| 35 virtual string16 GetPostOfficeBox() const; |
| 36 // Returns address neighborhood (e.g. Noe Valley, Nob Hill, Twin Peaks, ...). |
| 37 virtual string16 GetNeighborhood() const; |
| 38 // Returns address region such as state or province information |
| 39 // (e.g. Ontario, California, Hubei). |
| 40 virtual string16 GetRegion() const; |
| 41 // Returns address city. |
| 42 virtual string16 GetCity() const; |
| 43 // Returns address postal code or zip code. |
| 44 virtual string16 GetPostalCode() const; |
| 45 // Returns address country. |
| 46 virtual string16 GetCountry() const; |
| 47 |
| 48 // Returns contact's first name. |
| 49 virtual string16 GetFirstName() const; |
| 50 // Returns contact's middle name. |
| 51 virtual string16 GetMiddleName() const; |
| 52 // Returns contact's last name. |
| 53 virtual string16 GetLastName() const; |
| 54 // Returns contact's suffix (e.g. Ph.D, M.D., ...). |
| 55 virtual string16 GetSuffix() const; |
| 56 |
| 57 // Populates string vector parameter with contact's email addresses. |
| 58 virtual void GetEmailAddresses(std::vector<string16>* email_addresses) const; |
| 59 |
| 60 // Populates string vector parameter with contact's phones numbers. |
| 61 virtual void GetPhoneNumbers(std::vector<string16>* phone_numbers) const; |
| 62 |
| 63 private: |
| 64 JNIEnv* env_; |
| 65 // The reference to java |PersonalAutofillPopulator| which |
| 66 // actually extracts users contact information from the physical device |
| 67 base::android::ScopedJavaLocalRef<jobject> populator_; |
| 68 DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfileLoaderAndroid); |
| 69 }; |
| 70 |
| 71 } // namespace |
| 72 |
| 73 #endif // COMPONENTS_AUTOFILL_BROWSER_ANDROID_AUXILIARY_PROFILE_LOADER_ANDROID_
H_ |
OLD | NEW |