Index: chrome/browser/autofill/android/personal_data_manager_android.cc |
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc |
index 156ead71007dc6def02a3e45f40db521b4fcfc69..b3d09e0a520a7f2d3fe3cd11d364d460da442560 100644 |
--- a/chrome/browser/autofill/android/personal_data_manager_android.cc |
+++ b/chrome/browser/autofill/android/personal_data_manager_android.cc |
@@ -368,14 +368,16 @@ ScopedJavaLocalRef<jobjectArray> |
PersonalDataManagerAndroid::GetProfileLabelsForSettings( |
JNIEnv* env, |
const JavaParamRef<jobject>& unused_obj) { |
- return GetProfileLabels(env, false, personal_data_manager_->GetProfiles()); |
+ return GetProfileLabels(env, false, false, |
+ personal_data_manager_->GetProfiles()); |
} |
ScopedJavaLocalRef<jobjectArray> |
PersonalDataManagerAndroid::GetProfileLabelsToSuggest( |
JNIEnv* env, |
- const JavaParamRef<jobject>& unused_obj) { |
- return GetProfileLabels(env, true, |
+ const JavaParamRef<jobject>& unused_obj, |
+ jboolean include_name) { |
+ return GetProfileLabels(env, true, include_name, |
personal_data_manager_->GetProfilesToSuggest()); |
} |
@@ -657,11 +659,14 @@ ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDs( |
ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabels( |
JNIEnv* env, |
bool address_only, |
+ bool include_name, |
std::vector<AutofillProfile*> profiles) { |
std::unique_ptr<std::vector<ServerFieldType>> suggested_fields; |
size_t minimal_fields_shown = 2; |
if (address_only) { |
suggested_fields.reset(new std::vector<ServerFieldType>); |
+ if (include_name) |
+ suggested_fields->push_back(NAME_FULL); |
suggested_fields->push_back(COMPANY_NAME); |
suggested_fields->push_back(ADDRESS_HOME_LINE1); |
suggested_fields->push_back(ADDRESS_HOME_LINE2); |
@@ -674,9 +679,11 @@ ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabels( |
minimal_fields_shown = suggested_fields->size(); |
} |
+ ServerFieldType excluded_field = include_name ? UNKNOWN_TYPE : NAME_FULL; |
+ |
std::vector<base::string16> labels; |
AutofillProfile::CreateInferredLabels( |
- profiles, suggested_fields.get(), NAME_FULL, minimal_fields_shown, |
+ profiles, suggested_fields.get(), excluded_field, minimal_fields_shown, |
g_browser_process->GetApplicationLocale(), &labels); |
return base::android::ToJavaArrayOfStrings(env, labels); |