| OLD | NEW |
| 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 #include "chrome/browser/autofill/android/personal_data_manager_android.h" | 5 #include "chrome/browser/autofill/android/personal_data_manager_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void PopulateNativeProfileFromJava( | 72 void PopulateNativeProfileFromJava( |
| 73 const jobject& jprofile, | 73 const jobject& jprofile, |
| 74 JNIEnv* env, | 74 JNIEnv* env, |
| 75 AutofillProfile* profile) { | 75 AutofillProfile* profile) { |
| 76 profile->set_origin( | 76 profile->set_origin( |
| 77 ConvertJavaStringToUTF8( | 77 ConvertJavaStringToUTF8( |
| 78 Java_AutofillProfile_getOrigin(env, jprofile))); | 78 Java_AutofillProfile_getOrigin(env, jprofile))); |
| 79 profile->SetInfo( | 79 profile->SetInfo( |
| 80 AutofillType(NAME_FULL), | 80 AutofillType(NAME_FULL), |
| 81 ConvertJavaStringToUTF16(Java_AutofillProfile_getFullName(env, jprofile)), |
| 82 g_browser_process->GetApplicationLocale()); |
| 83 profile->SetRawInfo(autofill::COMPANY_NAME, |
| 84 ConvertJavaStringToUTF16( |
| 85 Java_AutofillProfile_getCompanyName(env, jprofile))); |
| 86 profile->SetRawInfo( |
| 87 autofill::ADDRESS_HOME_STREET_ADDRESS, |
| 81 ConvertJavaStringToUTF16( | 88 ConvertJavaStringToUTF16( |
| 82 Java_AutofillProfile_getFullName(env, jprofile)), | 89 Java_AutofillProfile_getStreetAddress(env, jprofile))); |
| 83 g_browser_process->GetApplicationLocale()); | 90 profile->SetRawInfo( |
| 84 profile->SetInfo( | 91 autofill::ADDRESS_HOME_STATE, |
| 85 AutofillType(COMPANY_NAME), | 92 ConvertJavaStringToUTF16(Java_AutofillProfile_getRegion(env, jprofile))); |
| 93 profile->SetRawInfo(autofill::ADDRESS_HOME_CITY, |
| 94 ConvertJavaStringToUTF16( |
| 95 Java_AutofillProfile_getLocality(env, jprofile))); |
| 96 profile->SetRawInfo( |
| 97 autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, |
| 86 ConvertJavaStringToUTF16( | 98 ConvertJavaStringToUTF16( |
| 87 Java_AutofillProfile_getCompanyName(env, jprofile)), | 99 Java_AutofillProfile_getDependentLocality(env, jprofile))); |
| 88 g_browser_process->GetApplicationLocale()); | 100 profile->SetRawInfo(autofill::ADDRESS_HOME_ZIP, |
| 89 profile->SetInfo( | 101 ConvertJavaStringToUTF16( |
| 90 AutofillType(ADDRESS_HOME_STREET_ADDRESS), | 102 Java_AutofillProfile_getPostalCode(env, jprofile))); |
| 91 ConvertJavaStringToUTF16( | 103 profile->SetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE, |
| 92 Java_AutofillProfile_getStreetAddress(env, jprofile)), | 104 ConvertJavaStringToUTF16( |
| 93 g_browser_process->GetApplicationLocale()); | 105 Java_AutofillProfile_getSortingCode(env, jprofile))); |
| 94 profile->SetInfo( | |
| 95 AutofillType(ADDRESS_HOME_STATE), | |
| 96 ConvertJavaStringToUTF16( | |
| 97 Java_AutofillProfile_getRegion(env, jprofile)), | |
| 98 g_browser_process->GetApplicationLocale()); | |
| 99 profile->SetInfo( | |
| 100 AutofillType(ADDRESS_HOME_CITY), | |
| 101 ConvertJavaStringToUTF16( | |
| 102 Java_AutofillProfile_getLocality(env, jprofile)), | |
| 103 g_browser_process->GetApplicationLocale()); | |
| 104 profile->SetInfo( | |
| 105 AutofillType(ADDRESS_HOME_DEPENDENT_LOCALITY), | |
| 106 ConvertJavaStringToUTF16( | |
| 107 Java_AutofillProfile_getDependentLocality(env, jprofile)), | |
| 108 g_browser_process->GetApplicationLocale()); | |
| 109 profile->SetInfo( | |
| 110 AutofillType(ADDRESS_HOME_ZIP), | |
| 111 ConvertJavaStringToUTF16( | |
| 112 Java_AutofillProfile_getPostalCode(env, jprofile)), | |
| 113 g_browser_process->GetApplicationLocale()); | |
| 114 profile->SetInfo( | |
| 115 AutofillType(ADDRESS_HOME_SORTING_CODE), | |
| 116 ConvertJavaStringToUTF16( | |
| 117 Java_AutofillProfile_getSortingCode(env, jprofile)), | |
| 118 g_browser_process->GetApplicationLocale()); | |
| 119 profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), | 106 profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), |
| 120 ConvertJavaStringToUTF16( | 107 ConvertJavaStringToUTF16( |
| 121 Java_AutofillProfile_getCountryCode(env, jprofile)), | 108 Java_AutofillProfile_getCountryCode(env, jprofile)), |
| 122 g_browser_process->GetApplicationLocale()); | 109 g_browser_process->GetApplicationLocale()); |
| 123 profile->SetInfo( | 110 profile->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, |
| 124 AutofillType(PHONE_HOME_WHOLE_NUMBER), | 111 ConvertJavaStringToUTF16( |
| 125 ConvertJavaStringToUTF16( | 112 Java_AutofillProfile_getPhoneNumber(env, jprofile))); |
| 126 Java_AutofillProfile_getPhoneNumber(env, jprofile)), | 113 profile->SetRawInfo(autofill::EMAIL_ADDRESS, |
| 127 g_browser_process->GetApplicationLocale()); | 114 ConvertJavaStringToUTF16( |
| 128 profile->SetInfo( | 115 Java_AutofillProfile_getEmailAddress(env, jprofile))); |
| 129 AutofillType(EMAIL_ADDRESS), | |
| 130 ConvertJavaStringToUTF16( | |
| 131 Java_AutofillProfile_getEmailAddress(env, jprofile)), | |
| 132 g_browser_process->GetApplicationLocale()); | |
| 133 profile->set_language_code( | 116 profile->set_language_code( |
| 134 ConvertJavaStringToUTF8( | 117 ConvertJavaStringToUTF8( |
| 135 Java_AutofillProfile_getLanguageCode(env, jprofile))); | 118 Java_AutofillProfile_getLanguageCode(env, jprofile))); |
| 136 } | 119 } |
| 137 | 120 |
| 138 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( | 121 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( |
| 139 JNIEnv* env, | 122 JNIEnv* env, |
| 140 const CreditCard& card) { | 123 const CreditCard& card) { |
| 141 return Java_CreditCard_create( | 124 return Java_CreditCard_create( |
| 142 env, ConvertUTF8ToJavaString(env, card.guid()).obj(), | 125 env, ConvertUTF8ToJavaString(env, card.guid()).obj(), |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 g_browser_process->GetApplicationLocale())).Release(); | 344 g_browser_process->GetApplicationLocale())).Release(); |
| 362 } | 345 } |
| 363 | 346 |
| 364 static jlong Init(JNIEnv* env, jobject obj) { | 347 static jlong Init(JNIEnv* env, jobject obj) { |
| 365 PersonalDataManagerAndroid* personal_data_manager_android = | 348 PersonalDataManagerAndroid* personal_data_manager_android = |
| 366 new PersonalDataManagerAndroid(env, obj); | 349 new PersonalDataManagerAndroid(env, obj); |
| 367 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 350 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 368 } | 351 } |
| 369 | 352 |
| 370 } // namespace autofill | 353 } // namespace autofill |
| OLD | NEW |