OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 // | |
Ilya Sherman
2013/03/09 01:42:58
nit: Replaces lines 4 and 5 with a single blank li
apiccion
2013/03/09 03:43:17
Done.
apiccion
2013/03/09 03:43:17
Done.
| |
6 #include "chrome/browser/autofill/android/auxiliary_profile_loader_android.h" | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/android/jni_android.h" | |
11 #include "base/android/jni_array.h" | |
12 #include "base/android/jni_local_ref_extensions.h" | |
13 #include "base/android/jni_string.h" | |
14 #include "jni/PersonalAutofillPopulator_jni.h" | |
15 | |
16 #define JAVA_METHOD(__jmethod__) Java_PersonalAutofillPopulator_##__jmethod__(\ | |
17 env_,\ | |
18 populator_.obj()) | |
Ilya Sherman
2013/03/09 01:42:58
nit: Please fix the indentation here.
apiccion
2013/03/09 03:43:17
Done.
| |
19 | |
20 using base::android::SafeJavaStringToUTF16; | |
21 | |
22 namespace autofill { | |
23 | |
24 bool RegisterAuxiliaryProfileLoader(JNIEnv* env) { | |
25 return RegisterNativesImpl(env); | |
26 } | |
27 | |
28 AuxiliaryProfileLoaderAndroid::AuxiliaryProfileLoaderAndroid() {} | |
29 | |
30 AuxiliaryProfileLoaderAndroid::~AuxiliaryProfileLoaderAndroid() { | |
31 } | |
32 | |
33 void AuxiliaryProfileLoaderAndroid::Init(JNIEnv* env, const jobject& context) { | |
34 env_ = env; | |
35 populator_ = Java_PersonalAutofillPopulator_create(env_, context); | |
36 } | |
37 | |
38 // Address info | |
39 string16 AuxiliaryProfileLoaderAndroid::GetStreet() const { | |
40 return SafeJavaStringToUTF16(JAVA_METHOD(getStreet)); | |
41 } | |
42 | |
43 string16 AuxiliaryProfileLoaderAndroid::GetPostOfficeBox() const { | |
44 return SafeJavaStringToUTF16(JAVA_METHOD(getPobox)); | |
45 } | |
46 | |
47 string16 AuxiliaryProfileLoaderAndroid::GetNeighborhood() const { | |
48 return SafeJavaStringToUTF16(JAVA_METHOD(getNeighborhood)); | |
49 } | |
50 | |
51 string16 AuxiliaryProfileLoaderAndroid::GetRegion() const { | |
52 return SafeJavaStringToUTF16(JAVA_METHOD(getRegion)); | |
53 } | |
54 | |
55 string16 AuxiliaryProfileLoaderAndroid::GetCity() const { | |
56 return SafeJavaStringToUTF16(JAVA_METHOD(getCity)); | |
57 } | |
58 | |
59 string16 AuxiliaryProfileLoaderAndroid::GetPostalCode() const { | |
60 return SafeJavaStringToUTF16(JAVA_METHOD(getPostalCode)); | |
61 } | |
62 | |
63 string16 AuxiliaryProfileLoaderAndroid::GetCountry() const { | |
64 return SafeJavaStringToUTF16(JAVA_METHOD(getCountry)); | |
65 } | |
66 | |
67 // Name info | |
68 string16 AuxiliaryProfileLoaderAndroid::GetFirstName() const { | |
69 return SafeJavaStringToUTF16(JAVA_METHOD(getFirstName)); | |
70 } | |
71 | |
72 string16 AuxiliaryProfileLoaderAndroid::GetMiddleName() const { | |
73 return SafeJavaStringToUTF16(JAVA_METHOD(getMiddleName)); | |
74 } | |
75 | |
76 string16 AuxiliaryProfileLoaderAndroid::GetLastName() const { | |
77 return SafeJavaStringToUTF16(JAVA_METHOD(getLastName)); | |
78 } | |
79 | |
80 string16 AuxiliaryProfileLoaderAndroid::GetSuffix() const { | |
81 return SafeJavaStringToUTF16(JAVA_METHOD(getSuffix)); | |
82 } | |
83 | |
84 // Email info | |
85 void AuxiliaryProfileLoaderAndroid::GetEmailAddresses( | |
86 std::vector<string16>* emails) const { | |
87 SafeJavaStringArrayToStringVector(JAVA_METHOD(getEmailAddresses), | |
88 env_, | |
89 emails); | |
90 } | |
91 | |
92 // Phone info | |
93 void AuxiliaryProfileLoaderAndroid::GetPhoneNumbers( | |
94 std::vector<string16>* phone_numbers) const { | |
95 SafeJavaStringArrayToStringVector(JAVA_METHOD(getPhoneNumbers), | |
96 env_, | |
97 phone_numbers); | |
98 } | |
99 | |
100 } // namespace | |
OLD | NEW |