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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); | 69 ConvertUTF8ToJavaString(env, profile.language_code()).obj()); |
70 } | 70 } |
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->SetRawInfo(autofill::NAME_FULL, |
Evan Stade
2015/05/15 22:26:45
this one should be SetInfo (note that AutofillOpti
Theresa
2015/05/16 04:37:22
Done.
| |
80 AutofillType(NAME_FULL), | 80 ConvertJavaStringToUTF16( |
81 Java_AutofillProfile_getFullName(env, jprofile))); | |
82 profile->SetRawInfo(autofill::COMPANY_NAME, | |
83 ConvertJavaStringToUTF16( | |
84 Java_AutofillProfile_getCompanyName(env, jprofile))); | |
85 profile->SetRawInfo( | |
86 autofill::ADDRESS_HOME_STREET_ADDRESS, | |
81 ConvertJavaStringToUTF16( | 87 ConvertJavaStringToUTF16( |
82 Java_AutofillProfile_getFullName(env, jprofile)), | 88 Java_AutofillProfile_getStreetAddress(env, jprofile))); |
83 g_browser_process->GetApplicationLocale()); | 89 profile->SetRawInfo( |
84 profile->SetInfo( | 90 autofill::ADDRESS_HOME_STATE, |
85 AutofillType(COMPANY_NAME), | 91 ConvertJavaStringToUTF16(Java_AutofillProfile_getRegion(env, jprofile))); |
92 profile->SetRawInfo(autofill::ADDRESS_HOME_CITY, | |
93 ConvertJavaStringToUTF16( | |
94 Java_AutofillProfile_getLocality(env, jprofile))); | |
95 profile->SetRawInfo( | |
96 autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, | |
86 ConvertJavaStringToUTF16( | 97 ConvertJavaStringToUTF16( |
87 Java_AutofillProfile_getCompanyName(env, jprofile)), | 98 Java_AutofillProfile_getDependentLocality(env, jprofile))); |
88 g_browser_process->GetApplicationLocale()); | 99 profile->SetRawInfo(autofill::ADDRESS_HOME_ZIP, |
89 profile->SetInfo( | 100 ConvertJavaStringToUTF16( |
90 AutofillType(ADDRESS_HOME_STREET_ADDRESS), | 101 Java_AutofillProfile_getPostalCode(env, jprofile))); |
91 ConvertJavaStringToUTF16( | 102 profile->SetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE, |
92 Java_AutofillProfile_getStreetAddress(env, jprofile)), | 103 ConvertJavaStringToUTF16( |
93 g_browser_process->GetApplicationLocale()); | 104 Java_AutofillProfile_getSortingCode(env, jprofile))); |
94 profile->SetInfo( | 105 profile->SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, |
95 AutofillType(ADDRESS_HOME_STATE), | 106 ConvertJavaStringToUTF16( |
96 ConvertJavaStringToUTF16( | 107 Java_AutofillProfile_getCountryCode(env, jprofile))); |
97 Java_AutofillProfile_getRegion(env, jprofile)), | 108 profile->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, |
98 g_browser_process->GetApplicationLocale()); | 109 ConvertJavaStringToUTF16( |
99 profile->SetInfo( | 110 Java_AutofillProfile_getPhoneNumber(env, jprofile))); |
100 AutofillType(ADDRESS_HOME_CITY), | 111 profile->SetRawInfo(autofill::EMAIL_ADDRESS, |
101 ConvertJavaStringToUTF16( | 112 ConvertJavaStringToUTF16( |
102 Java_AutofillProfile_getLocality(env, jprofile)), | 113 Java_AutofillProfile_getEmailAddress(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), | |
120 ConvertJavaStringToUTF16( | |
121 Java_AutofillProfile_getCountryCode(env, jprofile)), | |
122 g_browser_process->GetApplicationLocale()); | |
123 profile->SetInfo( | |
124 AutofillType(PHONE_HOME_WHOLE_NUMBER), | |
125 ConvertJavaStringToUTF16( | |
126 Java_AutofillProfile_getPhoneNumber(env, jprofile)), | |
127 g_browser_process->GetApplicationLocale()); | |
128 profile->SetInfo( | |
129 AutofillType(EMAIL_ADDRESS), | |
130 ConvertJavaStringToUTF16( | |
131 Java_AutofillProfile_getEmailAddress(env, jprofile)), | |
132 g_browser_process->GetApplicationLocale()); | |
133 profile->set_language_code( | 114 profile->set_language_code( |
134 ConvertJavaStringToUTF8( | 115 ConvertJavaStringToUTF8( |
135 Java_AutofillProfile_getLanguageCode(env, jprofile))); | 116 Java_AutofillProfile_getLanguageCode(env, jprofile))); |
136 } | 117 } |
137 | 118 |
138 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( | 119 ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( |
139 JNIEnv* env, | 120 JNIEnv* env, |
140 const CreditCard& card) { | 121 const CreditCard& card) { |
141 return Java_CreditCard_create( | 122 return Java_CreditCard_create( |
142 env, ConvertUTF8ToJavaString(env, card.guid()).obj(), | 123 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(); | 342 g_browser_process->GetApplicationLocale())).Release(); |
362 } | 343 } |
363 | 344 |
364 static jlong Init(JNIEnv* env, jobject obj) { | 345 static jlong Init(JNIEnv* env, jobject obj) { |
365 PersonalDataManagerAndroid* personal_data_manager_android = | 346 PersonalDataManagerAndroid* personal_data_manager_android = |
366 new PersonalDataManagerAndroid(env, obj); | 347 new PersonalDataManagerAndroid(env, obj); |
367 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 348 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
368 } | 349 } |
369 | 350 |
370 } // namespace autofill | 351 } // namespace autofill |
OLD | NEW |