Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 jboolean include_name_in_label, | 423 jboolean include_name_in_label, |
| 424 jboolean include_organization_in_label, | 424 jboolean include_organization_in_label, |
| 425 jboolean include_country_in_label) { | 425 jboolean include_country_in_label) { |
| 426 return GetProfileLabels(env, true /* address_only */, include_name_in_label, | 426 return GetProfileLabels(env, true /* address_only */, include_name_in_label, |
| 427 include_organization_in_label, | 427 include_organization_in_label, |
| 428 include_country_in_label, | 428 include_country_in_label, |
| 429 personal_data_manager_->GetProfilesToSuggest()); | 429 personal_data_manager_->GetProfilesToSuggest()); |
| 430 } | 430 } |
| 431 | 431 |
| 432 base::android::ScopedJavaLocalRef<jstring> | 432 base::android::ScopedJavaLocalRef<jstring> |
| 433 PersonalDataManagerAndroid::GetShippingAddressLabelWithCountryForPaymentRequest( | |
| 434 JNIEnv* env, | |
| 435 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 436 const base::android::JavaParamRef<jobject>& jprofile) { | |
| 437 return GetShippingAddressLabelForPaymentRequest( | |
| 438 env, jprofile, true /* include_country_in_label */); | |
| 439 } | |
| 440 | |
| 441 base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid:: | |
| 442 GetShippingAddressLabelWithoutCountryForPaymentRequest( | |
| 443 JNIEnv* env, | |
| 444 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 445 const base::android::JavaParamRef<jobject>& jprofile) { | |
| 446 return GetShippingAddressLabelForPaymentRequest( | |
| 447 env, jprofile, false /* include_country_in_label */); | |
| 448 } | |
| 449 | |
| 450 base::android::ScopedJavaLocalRef<jstring> | |
| 433 PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest( | 451 PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest( |
|
please use gerrit instead
2016/11/23 21:40:50
Order of methods in .h should match the order of m
sebsg
2016/11/25 15:55:20
Done.
| |
| 434 JNIEnv* env, | 452 JNIEnv* env, |
| 435 const base::android::JavaParamRef<jobject>& unused_obj, | 453 const base::android::JavaParamRef<jobject>& jprofile, |
| 436 const base::android::JavaParamRef<jobject>& jprofile) { | 454 bool include_country_in_label) { |
| 437 // The full name is not included in the label for shipping address. It is | 455 // The full name is not included in the label for shipping address. It is |
| 438 // added separately instead. | 456 // added separately instead. |
| 439 std::vector<ServerFieldType> label_fields; | 457 std::vector<ServerFieldType> label_fields; |
| 440 label_fields.push_back(COMPANY_NAME); | 458 label_fields.push_back(COMPANY_NAME); |
| 441 label_fields.push_back(ADDRESS_HOME_LINE1); | 459 label_fields.push_back(ADDRESS_HOME_LINE1); |
| 442 label_fields.push_back(ADDRESS_HOME_LINE2); | 460 label_fields.push_back(ADDRESS_HOME_LINE2); |
| 443 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | 461 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); |
| 444 label_fields.push_back(ADDRESS_HOME_CITY); | 462 label_fields.push_back(ADDRESS_HOME_CITY); |
| 445 label_fields.push_back(ADDRESS_HOME_STATE); | 463 label_fields.push_back(ADDRESS_HOME_STATE); |
| 446 label_fields.push_back(ADDRESS_HOME_ZIP); | 464 label_fields.push_back(ADDRESS_HOME_ZIP); |
| 447 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | 465 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); |
| 448 label_fields.push_back(ADDRESS_HOME_COUNTRY); | 466 if (include_country_in_label) |
| 467 label_fields.push_back(ADDRESS_HOME_COUNTRY); | |
| 449 | 468 |
| 450 AutofillProfile profile; | 469 AutofillProfile profile; |
| 451 PopulateNativeProfileFromJava(jprofile, env, &profile); | 470 PopulateNativeProfileFromJava(jprofile, env, &profile); |
| 452 | 471 |
| 453 return ConvertUTF16ToJavaString( | 472 return ConvertUTF16ToJavaString( |
| 454 env, profile.ConstructInferredLabel( | 473 env, profile.ConstructInferredLabel( |
| 455 label_fields, label_fields.size(), | 474 label_fields, label_fields.size(), |
| 456 g_browser_process->GetApplicationLocale())); | 475 g_browser_process->GetApplicationLocale())); |
| 457 } | 476 } |
| 458 | 477 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); | 927 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); |
| 909 } | 928 } |
| 910 | 929 |
| 911 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 930 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 912 PersonalDataManagerAndroid* personal_data_manager_android = | 931 PersonalDataManagerAndroid* personal_data_manager_android = |
| 913 new PersonalDataManagerAndroid(env, obj); | 932 new PersonalDataManagerAndroid(env, obj); |
| 914 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 933 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 915 } | 934 } |
| 916 | 935 |
| 917 } // namespace autofill | 936 } // namespace autofill |
| OLD | NEW |