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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 jboolean include_name_in_label, | 402 jboolean include_name_in_label, |
| 403 jboolean include_organization_in_label, | 403 jboolean include_organization_in_label, |
| 404 jboolean include_country_in_label) { | 404 jboolean include_country_in_label) { |
| 405 return GetProfileLabels(env, true /* address_only */, include_name_in_label, | 405 return GetProfileLabels(env, true /* address_only */, include_name_in_label, |
| 406 include_organization_in_label, | 406 include_organization_in_label, |
| 407 include_country_in_label, | 407 include_country_in_label, |
| 408 personal_data_manager_->GetProfilesToSuggest()); | 408 personal_data_manager_->GetProfilesToSuggest()); |
| 409 } | 409 } |
| 410 | 410 |
| 411 base::android::ScopedJavaLocalRef<jstring> | 411 base::android::ScopedJavaLocalRef<jstring> |
| 412 PersonalDataManagerAndroid::GetAddressLabelForPaymentRequest( | 412 PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest( |
| 413 JNIEnv* env, | 413 JNIEnv* env, |
| 414 const base::android::JavaParamRef<jobject>& unused_obj, | 414 const base::android::JavaParamRef<jobject>& unused_obj, |
| 415 const base::android::JavaParamRef<jobject>& jprofile) { | 415 const base::android::JavaParamRef<jobject>& jprofile) { |
| 416 // The full name is not included in the label for shipping address. It is | |
| 417 // added separately instead. | |
| 416 std::vector<ServerFieldType> label_fields; | 418 std::vector<ServerFieldType> label_fields; |
| 417 label_fields.push_back(COMPANY_NAME); | 419 label_fields.push_back(COMPANY_NAME); |
| 418 label_fields.push_back(ADDRESS_HOME_LINE1); | 420 label_fields.push_back(ADDRESS_HOME_LINE1); |
| 419 label_fields.push_back(ADDRESS_HOME_LINE2); | 421 label_fields.push_back(ADDRESS_HOME_LINE2); |
| 420 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | 422 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); |
| 421 label_fields.push_back(ADDRESS_HOME_CITY); | 423 label_fields.push_back(ADDRESS_HOME_CITY); |
| 422 label_fields.push_back(ADDRESS_HOME_STATE); | 424 label_fields.push_back(ADDRESS_HOME_STATE); |
| 423 label_fields.push_back(ADDRESS_HOME_ZIP); | 425 label_fields.push_back(ADDRESS_HOME_ZIP); |
| 424 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | 426 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); |
| 425 label_fields.push_back(ADDRESS_HOME_COUNTRY); | 427 label_fields.push_back(ADDRESS_HOME_COUNTRY); |
| 426 | 428 |
| 427 AutofillProfile profile; | 429 AutofillProfile profile; |
| 428 PopulateNativeProfileFromJava(jprofile, env, &profile); | 430 PopulateNativeProfileFromJava(jprofile, env, &profile); |
| 429 | 431 |
| 430 return ConvertUTF16ToJavaString( | 432 return ConvertUTF16ToJavaString( |
| 431 env, profile.ConstructInferredLabel( | 433 env, profile.ConstructInferredLabel( |
| 432 label_fields, label_fields.size(), | 434 label_fields, label_fields.size(), |
| 433 g_browser_process->GetApplicationLocale())); | 435 g_browser_process->GetApplicationLocale())); |
| 434 } | 436 } |
| 435 | 437 |
| 438 base::android::ScopedJavaLocalRef<jstring> | |
| 439 PersonalDataManagerAndroid::GetBillingAddressLabelForPaymentRequest( | |
| 440 JNIEnv* env, | |
| 441 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 442 const base::android::JavaParamRef<jobject>& jprofile) { | |
| 443 // The company name is not included in the billing address label. | |
|
please use gerrit instead
2016/11/21 16:34:53
s/company name/company name and country/
| |
| 444 std::vector<ServerFieldType> label_fields; | |
| 445 label_fields.push_back(NAME_FULL); | |
| 446 label_fields.push_back(ADDRESS_HOME_LINE1); | |
| 447 label_fields.push_back(ADDRESS_HOME_LINE2); | |
| 448 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | |
| 449 label_fields.push_back(ADDRESS_HOME_CITY); | |
| 450 label_fields.push_back(ADDRESS_HOME_STATE); | |
| 451 label_fields.push_back(ADDRESS_HOME_ZIP); | |
| 452 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | |
| 453 | |
| 454 AutofillProfile profile; | |
| 455 PopulateNativeProfileFromJava(jprofile, env, &profile); | |
| 456 | |
| 457 return ConvertUTF16ToJavaString( | |
| 458 env, profile.ConstructInferredLabel( | |
| 459 label_fields, label_fields.size(), | |
| 460 g_browser_process->GetApplicationLocale())); | |
| 461 } | |
| 462 | |
| 436 base::android::ScopedJavaLocalRef<jobjectArray> | 463 base::android::ScopedJavaLocalRef<jobjectArray> |
| 437 PersonalDataManagerAndroid::GetCreditCardGUIDsForSettings( | 464 PersonalDataManagerAndroid::GetCreditCardGUIDsForSettings( |
| 438 JNIEnv* env, | 465 JNIEnv* env, |
| 439 const base::android::JavaParamRef<jobject>& unused_obj) { | 466 const base::android::JavaParamRef<jobject>& unused_obj) { |
| 440 return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCards()); | 467 return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCards()); |
| 441 } | 468 } |
| 442 | 469 |
| 443 base::android::ScopedJavaLocalRef<jobjectArray> | 470 base::android::ScopedJavaLocalRef<jobjectArray> |
| 444 PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( | 471 PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( |
| 445 JNIEnv* env, | 472 JNIEnv* env, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); | 887 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); |
| 861 } | 888 } |
| 862 | 889 |
| 863 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 890 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 864 PersonalDataManagerAndroid* personal_data_manager_android = | 891 PersonalDataManagerAndroid* personal_data_manager_android = |
| 865 new PersonalDataManagerAndroid(env, obj); | 892 new PersonalDataManagerAndroid(env, obj); |
| 866 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 893 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 867 } | 894 } |
| 868 | 895 |
| 869 } // namespace autofill | 896 } // namespace autofill |
| OLD | NEW |