Chromium Code Reviews| 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 #include "chrome/browser/autofill/auxiliary_profile_loader_impl_android.h" | |
| 6 | |
| 7 #include <vector> | |
|
Ilya Sherman
2013/03/01 01:55:04
nit: Leave a blank line after this one.
apiccion
2013/03/02 03:37:01
Done.
| |
| 8 #include "base/android/jni_android.h" | |
| 9 #include "base/android/jni_array.h" | |
| 10 #include "base/android/jni_local_ref_extensions.h" | |
| 11 #include "base/android/jni_string.h" | |
| 12 #include "jni/PersonalAutofillPopulator_jni.h" | |
| 13 | |
| 14 #define JM(__jmethod__) Java_PersonalAutofillPopulator_##__jmethod__(env_,\ | |
| 15 populator_.obj()) | |
|
Ilya Sherman
2013/03/01 01:55:04
nit: Please don't use abbreviations in code. If y
apiccion
2013/03/02 03:37:01
Done.
| |
| 16 | |
| 17 using namespace base::android; | |
|
Ilya Sherman
2013/03/01 01:55:04
nit: "using namespace" is disallowed by the style
apiccion
2013/03/02 03:37:01
Done.
| |
| 18 | |
| 19 bool RegisterAuxiliaryProfileLoader(JNIEnv* env) { | |
| 20 return RegisterNativesImpl(env); | |
| 21 } | |
| 22 | |
| 23 AuxiliaryProfileLoaderImplAndroid::AuxiliaryProfileLoaderImplAndroid() { | |
| 24 env_ = base::android::AttachCurrentThread(); | |
| 25 populator_ = Java_PersonalAutofillPopulator_create(env_, | |
| 26 base::android::GetApplicationContext()); | |
|
Ilya Sherman
2013/03/01 01:55:04
nit: The indentation is off here.
Ilya Sherman
2013/03/01 01:55:04
Any reason why you can't do these initializations
apiccion
2013/03/02 03:37:01
Done.
apiccion
2013/03/02 03:37:01
Done.
| |
| 27 } | |
| 28 | |
| 29 // Address info | |
| 30 string16 AuxiliaryProfileLoaderImplAndroid::GetStreet() { | |
| 31 return SafeJavaStringToUTF16(JM(getStreet)); | |
| 32 } | |
| 33 | |
| 34 string16 AuxiliaryProfileLoaderImplAndroid::GetPobox() { | |
| 35 return SafeJavaStringToUTF16(JM(getPobox)); | |
| 36 } | |
| 37 | |
| 38 string16 AuxiliaryProfileLoaderImplAndroid::GetNeighborhood() { | |
| 39 return SafeJavaStringToUTF16(JM(getNeighborhood)); | |
| 40 } | |
| 41 | |
| 42 string16 AuxiliaryProfileLoaderImplAndroid::GetRegion() { | |
| 43 return SafeJavaStringToUTF16(JM(getRegion)); | |
| 44 } | |
| 45 | |
| 46 string16 AuxiliaryProfileLoaderImplAndroid::GetCity() { | |
| 47 return SafeJavaStringToUTF16(JM(getCity)); | |
| 48 } | |
| 49 | |
| 50 string16 AuxiliaryProfileLoaderImplAndroid::GetPostalCode() { | |
| 51 return SafeJavaStringToUTF16(JM(getPostalCode)); | |
| 52 } | |
| 53 | |
| 54 string16 AuxiliaryProfileLoaderImplAndroid::GetCountry() { | |
| 55 return SafeJavaStringToUTF16(JM(getCountry)); | |
| 56 } | |
| 57 | |
| 58 // Name info | |
| 59 string16 AuxiliaryProfileLoaderImplAndroid::GetFirstName() { | |
| 60 return SafeJavaStringToUTF16(JM(getFirstName)); | |
| 61 } | |
| 62 | |
| 63 string16 AuxiliaryProfileLoaderImplAndroid::GetMiddleName() { | |
| 64 return SafeJavaStringToUTF16(JM(getMiddleName)); | |
| 65 } | |
| 66 | |
| 67 string16 AuxiliaryProfileLoaderImplAndroid::GetLastName() { | |
| 68 return SafeJavaStringToUTF16(JM(getLastName)); | |
| 69 } | |
| 70 | |
| 71 string16 AuxiliaryProfileLoaderImplAndroid::GetSuffix() { | |
| 72 return SafeJavaStringToUTF16(JM(getSuffix)); | |
| 73 } | |
| 74 | |
| 75 // Email info | |
| 76 std::vector<string16> AuxiliaryProfileLoaderImplAndroid::GetEmailAddresses() { | |
| 77 return SafeJavaStringArrayToStringVector(JM(getEmailAddresses), env_); | |
| 78 } | |
| 79 | |
| 80 // Phone info | |
| 81 std::vector<string16> AuxiliaryProfileLoaderImplAndroid::GetPhoneNumbers() { | |
| 82 return SafeJavaStringArrayToStringVector(JM(getPhoneNumbers), env_); | |
| 83 } | |
| OLD | NEW |