| 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_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); | 70 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void PopulateNativeProfileFromJava( | 73 void PopulateNativeProfileFromJava( |
| 74 const jobject& jprofile, | 74 const jobject& jprofile, |
| 75 JNIEnv* env, | 75 JNIEnv* env, |
| 76 AutofillProfile* profile) { | 76 AutofillProfile* profile) { |
| 77 profile->set_origin( | 77 profile->set_origin( |
| 78 ConvertJavaStringToUTF8( | 78 ConvertJavaStringToUTF8( |
| 79 Java_AutofillProfile_getOrigin(env, jprofile))); | 79 Java_AutofillProfile_getOrigin(env, jprofile))); |
| 80 profile->SetRawInfo( | 80 profile->SetInfo( |
| 81 NAME_FULL, | 81 AutofillType(NAME_FULL), |
| 82 ConvertJavaStringToUTF16( | 82 ConvertJavaStringToUTF16( |
| 83 Java_AutofillProfile_getFullName(env, jprofile))); | 83 Java_AutofillProfile_getFullName(env, jprofile)), |
| 84 profile->SetRawInfo( | 84 g_browser_process->GetApplicationLocale()); |
| 85 COMPANY_NAME, | 85 profile->SetInfo( |
| 86 AutofillType(COMPANY_NAME), |
| 86 ConvertJavaStringToUTF16( | 87 ConvertJavaStringToUTF16( |
| 87 Java_AutofillProfile_getCompanyName(env, jprofile))); | 88 Java_AutofillProfile_getCompanyName(env, jprofile)), |
| 88 profile->SetRawInfo( | 89 g_browser_process->GetApplicationLocale()); |
| 89 ADDRESS_HOME_STREET_ADDRESS, | 90 profile->SetInfo( |
| 91 AutofillType(ADDRESS_HOME_STREET_ADDRESS), |
| 90 ConvertJavaStringToUTF16( | 92 ConvertJavaStringToUTF16( |
| 91 Java_AutofillProfile_getStreetAddress(env, jprofile))); | 93 Java_AutofillProfile_getStreetAddress(env, jprofile)), |
| 92 profile->SetRawInfo( | 94 g_browser_process->GetApplicationLocale()); |
| 93 ADDRESS_HOME_STATE, | 95 profile->SetInfo( |
| 96 AutofillType(ADDRESS_HOME_STATE), |
| 94 ConvertJavaStringToUTF16( | 97 ConvertJavaStringToUTF16( |
| 95 Java_AutofillProfile_getRegion(env, jprofile))); | 98 Java_AutofillProfile_getRegion(env, jprofile)), |
| 96 profile->SetRawInfo( | 99 g_browser_process->GetApplicationLocale()); |
| 97 ADDRESS_HOME_CITY, | 100 profile->SetInfo( |
| 101 AutofillType(ADDRESS_HOME_CITY), |
| 98 ConvertJavaStringToUTF16( | 102 ConvertJavaStringToUTF16( |
| 99 Java_AutofillProfile_getLocality(env, jprofile))); | 103 Java_AutofillProfile_getLocality(env, jprofile)), |
| 100 profile->SetRawInfo( | 104 g_browser_process->GetApplicationLocale()); |
| 101 ADDRESS_HOME_DEPENDENT_LOCALITY, | 105 profile->SetInfo( |
| 106 AutofillType(ADDRESS_HOME_DEPENDENT_LOCALITY), |
| 102 ConvertJavaStringToUTF16( | 107 ConvertJavaStringToUTF16( |
| 103 Java_AutofillProfile_getDependentLocality(env, jprofile))); | 108 Java_AutofillProfile_getDependentLocality(env, jprofile)), |
| 104 profile->SetRawInfo( | 109 g_browser_process->GetApplicationLocale()); |
| 105 ADDRESS_HOME_ZIP, | 110 profile->SetInfo( |
| 111 AutofillType(ADDRESS_HOME_ZIP), |
| 106 ConvertJavaStringToUTF16( | 112 ConvertJavaStringToUTF16( |
| 107 Java_AutofillProfile_getPostalCode(env, jprofile))); | 113 Java_AutofillProfile_getPostalCode(env, jprofile)), |
| 108 profile->SetRawInfo( | 114 g_browser_process->GetApplicationLocale()); |
| 109 ADDRESS_HOME_SORTING_CODE, | 115 profile->SetInfo( |
| 116 AutofillType(ADDRESS_HOME_SORTING_CODE), |
| 110 ConvertJavaStringToUTF16( | 117 ConvertJavaStringToUTF16( |
| 111 Java_AutofillProfile_getSortingCode(env, jprofile))); | 118 Java_AutofillProfile_getSortingCode(env, jprofile)), |
| 119 g_browser_process->GetApplicationLocale()); |
| 112 profile->SetInfo( | 120 profile->SetInfo( |
| 113 AutofillType(ADDRESS_HOME_COUNTRY), | 121 AutofillType(ADDRESS_HOME_COUNTRY), |
| 114 ConvertJavaStringToUTF16( | 122 ConvertJavaStringToUTF16( |
| 115 Java_AutofillProfile_getCountry(env, jprofile)), | 123 Java_AutofillProfile_getCountry(env, jprofile)), |
| 116 g_browser_process->GetApplicationLocale()); | 124 g_browser_process->GetApplicationLocale()); |
| 117 profile->SetRawInfo( | 125 profile->SetInfo( |
| 118 PHONE_HOME_WHOLE_NUMBER, | 126 AutofillType(PHONE_HOME_WHOLE_NUMBER), |
| 119 ConvertJavaStringToUTF16( | 127 ConvertJavaStringToUTF16( |
| 120 Java_AutofillProfile_getPhoneNumber(env, jprofile))); | 128 Java_AutofillProfile_getPhoneNumber(env, jprofile)), |
| 121 profile->SetRawInfo( | 129 g_browser_process->GetApplicationLocale()); |
| 122 EMAIL_ADDRESS, | 130 profile->SetInfo( |
| 131 AutofillType(EMAIL_ADDRESS), |
| 123 ConvertJavaStringToUTF16( | 132 ConvertJavaStringToUTF16( |
| 124 Java_AutofillProfile_getEmailAddress(env, jprofile))); | 133 Java_AutofillProfile_getEmailAddress(env, jprofile)), |
| 134 g_browser_process->GetApplicationLocale()); |
| 125 profile->set_language_code( | 135 profile->set_language_code( |
| 126 ConvertJavaStringToUTF8( | 136 ConvertJavaStringToUTF8( |
| 127 Java_AutofillProfile_getLanguageCode(env, jprofile))); | 137 Java_AutofillProfile_getLanguageCode(env, jprofile))); |
| 128 } | 138 } |
| 129 | 139 |
| 130 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( | 140 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( |
| 131 JNIEnv* env, | 141 JNIEnv* env, |
| 132 const CreditCard& card) { | 142 const CreditCard& card) { |
| 133 return Java_CreditCard_create( | 143 return Java_CreditCard_create( |
| 134 env, | 144 env, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 g_browser_process->GetApplicationLocale())).Release(); | 331 g_browser_process->GetApplicationLocale())).Release(); |
| 322 } | 332 } |
| 323 | 333 |
| 324 static jlong Init(JNIEnv* env, jobject obj) { | 334 static jlong Init(JNIEnv* env, jobject obj) { |
| 325 PersonalDataManagerAndroid* personal_data_manager_android = | 335 PersonalDataManagerAndroid* personal_data_manager_android = |
| 326 new PersonalDataManagerAndroid(env, obj); | 336 new PersonalDataManagerAndroid(env, obj); |
| 327 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 337 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 328 } | 338 } |
| 329 | 339 |
| 330 } // namespace autofill | 340 } // namespace autofill |
| OLD | NEW |