Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: chrome/browser/autofill/android/personal_data_manager_android.cc

Issue 2526943003: [Payments] Remove country from shipping label in bottom and fullsheet. (Closed)
Patch Set: Moved assertion Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/android/personal_data_manager_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7de6fd815d4a1155705443f4fda2f1925919d198..3a5ad199fa1ab9d30acf74e136fa25c8d6858177 100644
--- a/chrome/browser/autofill/android/personal_data_manager_android.cc
+++ b/chrome/browser/autofill/android/personal_data_manager_android.cc
@@ -430,30 +430,21 @@ PersonalDataManagerAndroid::GetProfileLabelsToSuggest(
}
base::android::ScopedJavaLocalRef<jstring>
-PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest(
+PersonalDataManagerAndroid::GetShippingAddressLabelWithCountryForPaymentRequest(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& unused_obj,
const base::android::JavaParamRef<jobject>& jprofile) {
- // The full name is not included in the label for shipping address. It is
- // added separately instead.
- std::vector<ServerFieldType> label_fields;
- label_fields.push_back(COMPANY_NAME);
- label_fields.push_back(ADDRESS_HOME_LINE1);
- label_fields.push_back(ADDRESS_HOME_LINE2);
- label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY);
- label_fields.push_back(ADDRESS_HOME_CITY);
- label_fields.push_back(ADDRESS_HOME_STATE);
- label_fields.push_back(ADDRESS_HOME_ZIP);
- label_fields.push_back(ADDRESS_HOME_SORTING_CODE);
- label_fields.push_back(ADDRESS_HOME_COUNTRY);
-
- AutofillProfile profile;
- PopulateNativeProfileFromJava(jprofile, env, &profile);
+ return GetShippingAddressLabelForPaymentRequest(
+ env, jprofile, true /* include_country_in_label */);
+}
- return ConvertUTF16ToJavaString(
- env, profile.ConstructInferredLabel(
- label_fields, label_fields.size(),
- g_browser_process->GetApplicationLocale()));
+base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::
+ GetShippingAddressLabelWithoutCountryForPaymentRequest(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& unused_obj,
+ const base::android::JavaParamRef<jobject>& jprofile) {
+ return GetShippingAddressLabelForPaymentRequest(
+ env, jprofile, false /* include_country_in_label */);
}
base::android::ScopedJavaLocalRef<jstring>
@@ -821,6 +812,11 @@ ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDs(
return base::android::ToJavaArrayOfStrings(env, guids);
}
+bool PersonalDataManagerAndroid::AreRulesLoadedForRegion(
+ const std::string& region_code) {
+ return address_validator_.AreRulesLoadedForRegion(region_code);
+}
+
ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabels(
JNIEnv* env,
bool address_only,
@@ -859,9 +855,32 @@ ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabels(
return base::android::ToJavaArrayOfStrings(env, labels);
}
-bool PersonalDataManagerAndroid::AreRulesLoadedForRegion(
- const std::string& region_code) {
- return address_validator_.AreRulesLoadedForRegion(region_code);
+base::android::ScopedJavaLocalRef<jstring>
+PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jprofile,
+ bool include_country_in_label) {
+ // The full name is not included in the label for shipping address. It is
+ // added separately instead.
+ std::vector<ServerFieldType> label_fields;
+ label_fields.push_back(COMPANY_NAME);
+ label_fields.push_back(ADDRESS_HOME_LINE1);
+ label_fields.push_back(ADDRESS_HOME_LINE2);
+ label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY);
+ label_fields.push_back(ADDRESS_HOME_CITY);
+ label_fields.push_back(ADDRESS_HOME_STATE);
+ label_fields.push_back(ADDRESS_HOME_ZIP);
+ label_fields.push_back(ADDRESS_HOME_SORTING_CODE);
+ if (include_country_in_label)
+ label_fields.push_back(ADDRESS_HOME_COUNTRY);
+
+ AutofillProfile profile;
+ PopulateNativeProfileFromJava(jprofile, env, &profile);
+
+ return ConvertUTF16ToJavaString(
+ env, profile.ConstructInferredLabel(
+ label_fields, label_fields.size(),
+ g_browser_process->GetApplicationLocale()));
}
// Returns whether the Autofill feature is enabled.
« no previous file with comments | « chrome/browser/autofill/android/personal_data_manager_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698