| 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 24 matching lines...) Expand all Loading... |
| 35 ScopedJavaLocalRef<jobject> CreateJavaProfileFromNative( | 35 ScopedJavaLocalRef<jobject> CreateJavaProfileFromNative( |
| 36 JNIEnv* env, | 36 JNIEnv* env, |
| 37 const AutofillProfile& profile) { | 37 const AutofillProfile& profile) { |
| 38 return Java_AutofillProfile_create( | 38 return Java_AutofillProfile_create( |
| 39 env, | 39 env, |
| 40 ConvertUTF8ToJavaString(env, profile.guid()).obj(), | 40 ConvertUTF8ToJavaString(env, profile.guid()).obj(), |
| 41 ConvertUTF8ToJavaString(env, profile.origin()).obj(), | 41 ConvertUTF8ToJavaString(env, profile.origin()).obj(), |
| 42 ConvertUTF16ToJavaString(env, profile.GetRawInfo(NAME_FULL)).obj(), | 42 ConvertUTF16ToJavaString(env, profile.GetRawInfo(NAME_FULL)).obj(), |
| 43 ConvertUTF16ToJavaString(env, profile.GetRawInfo(COMPANY_NAME)).obj(), | 43 ConvertUTF16ToJavaString(env, profile.GetRawInfo(COMPANY_NAME)).obj(), |
| 44 ConvertUTF16ToJavaString( | 44 ConvertUTF16ToJavaString( |
| 45 env, | 45 env, profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)).obj(), |
| 46 profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)).obj(), | 46 ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_STATE)) |
| 47 .obj(), |
| 48 ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_CITY)) |
| 49 .obj(), |
| 47 ConvertUTF16ToJavaString( | 50 ConvertUTF16ToJavaString( |
| 48 env, | 51 env, profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY)).obj(), |
| 49 profile.GetRawInfo(ADDRESS_HOME_STATE)).obj(), | 52 ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_ZIP)).obj(), |
| 50 ConvertUTF16ToJavaString( | 53 ConvertUTF16ToJavaString( |
| 51 env, | 54 env, profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)).obj(), |
| 52 profile.GetRawInfo(ADDRESS_HOME_CITY)).obj(), | 55 ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) |
| 53 ConvertUTF16ToJavaString( | 56 .obj(), |
| 54 env, | 57 ConvertUTF16ToJavaString(env, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)) |
| 55 profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY)).obj(), | 58 .obj(), |
| 56 ConvertUTF16ToJavaString( | |
| 57 env, | |
| 58 profile.GetRawInfo(ADDRESS_HOME_ZIP)).obj(), | |
| 59 ConvertUTF16ToJavaString( | |
| 60 env, | |
| 61 profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)).obj(), | |
| 62 ConvertUTF16ToJavaString( | |
| 63 env, | |
| 64 profile.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), | |
| 65 g_browser_process->GetApplicationLocale())).obj(), | |
| 66 ConvertUTF16ToJavaString( | |
| 67 env, | |
| 68 profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)).obj(), | |
| 69 ConvertUTF16ToJavaString(env, profile.GetRawInfo(EMAIL_ADDRESS)).obj(), | 59 ConvertUTF16ToJavaString(env, profile.GetRawInfo(EMAIL_ADDRESS)).obj(), |
| 70 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); | 60 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); |
| 71 } | 61 } |
| 72 | 62 |
| 73 void PopulateNativeProfileFromJava( | 63 void PopulateNativeProfileFromJava( |
| 74 const jobject& jprofile, | 64 const jobject& jprofile, |
| 75 JNIEnv* env, | 65 JNIEnv* env, |
| 76 AutofillProfile* profile) { | 66 AutofillProfile* profile) { |
| 77 profile->set_origin( | 67 profile->set_origin( |
| 78 ConvertJavaStringToUTF8( | 68 ConvertJavaStringToUTF8( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 profile->SetInfo( | 100 profile->SetInfo( |
| 111 AutofillType(ADDRESS_HOME_ZIP), | 101 AutofillType(ADDRESS_HOME_ZIP), |
| 112 ConvertJavaStringToUTF16( | 102 ConvertJavaStringToUTF16( |
| 113 Java_AutofillProfile_getPostalCode(env, jprofile)), | 103 Java_AutofillProfile_getPostalCode(env, jprofile)), |
| 114 g_browser_process->GetApplicationLocale()); | 104 g_browser_process->GetApplicationLocale()); |
| 115 profile->SetInfo( | 105 profile->SetInfo( |
| 116 AutofillType(ADDRESS_HOME_SORTING_CODE), | 106 AutofillType(ADDRESS_HOME_SORTING_CODE), |
| 117 ConvertJavaStringToUTF16( | 107 ConvertJavaStringToUTF16( |
| 118 Java_AutofillProfile_getSortingCode(env, jprofile)), | 108 Java_AutofillProfile_getSortingCode(env, jprofile)), |
| 119 g_browser_process->GetApplicationLocale()); | 109 g_browser_process->GetApplicationLocale()); |
| 120 profile->SetInfo( | 110 profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), |
| 121 AutofillType(ADDRESS_HOME_COUNTRY), | 111 ConvertJavaStringToUTF16( |
| 122 ConvertJavaStringToUTF16( | 112 Java_AutofillProfile_getCountryCode(env, jprofile)), |
| 123 Java_AutofillProfile_getCountry(env, jprofile)), | 113 g_browser_process->GetApplicationLocale()); |
| 124 g_browser_process->GetApplicationLocale()); | |
| 125 profile->SetInfo( | 114 profile->SetInfo( |
| 126 AutofillType(PHONE_HOME_WHOLE_NUMBER), | 115 AutofillType(PHONE_HOME_WHOLE_NUMBER), |
| 127 ConvertJavaStringToUTF16( | 116 ConvertJavaStringToUTF16( |
| 128 Java_AutofillProfile_getPhoneNumber(env, jprofile)), | 117 Java_AutofillProfile_getPhoneNumber(env, jprofile)), |
| 129 g_browser_process->GetApplicationLocale()); | 118 g_browser_process->GetApplicationLocale()); |
| 130 profile->SetInfo( | 119 profile->SetInfo( |
| 131 AutofillType(EMAIL_ADDRESS), | 120 AutofillType(EMAIL_ADDRESS), |
| 132 ConvertJavaStringToUTF16( | 121 ConvertJavaStringToUTF16( |
| 133 Java_AutofillProfile_getEmailAddress(env, jprofile)), | 122 Java_AutofillProfile_getEmailAddress(env, jprofile)), |
| 134 g_browser_process->GetApplicationLocale()); | 123 g_browser_process->GetApplicationLocale()); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 g_browser_process->GetApplicationLocale())).Release(); | 320 g_browser_process->GetApplicationLocale())).Release(); |
| 332 } | 321 } |
| 333 | 322 |
| 334 static jlong Init(JNIEnv* env, jobject obj) { | 323 static jlong Init(JNIEnv* env, jobject obj) { |
| 335 PersonalDataManagerAndroid* personal_data_manager_android = | 324 PersonalDataManagerAndroid* personal_data_manager_android = |
| 336 new PersonalDataManagerAndroid(env, obj); | 325 new PersonalDataManagerAndroid(env, obj); |
| 337 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 326 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 338 } | 327 } |
| 339 | 328 |
| 340 } // namespace autofill | 329 } // namespace autofill |
| OLD | NEW |