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 std::vector<ServerFieldType> label_fields; | 416 std::vector<ServerFieldType> label_fields; |
| 417 label_fields.push_back(COMPANY_NAME); | 417 label_fields.push_back(COMPANY_NAME); |
| 418 label_fields.push_back(ADDRESS_HOME_LINE1); | 418 label_fields.push_back(ADDRESS_HOME_LINE1); |
| 419 label_fields.push_back(ADDRESS_HOME_LINE2); | 419 label_fields.push_back(ADDRESS_HOME_LINE2); |
| 420 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | 420 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); |
| 421 label_fields.push_back(ADDRESS_HOME_CITY); | 421 label_fields.push_back(ADDRESS_HOME_CITY); |
| 422 label_fields.push_back(ADDRESS_HOME_STATE); | 422 label_fields.push_back(ADDRESS_HOME_STATE); |
| 423 label_fields.push_back(ADDRESS_HOME_ZIP); | 423 label_fields.push_back(ADDRESS_HOME_ZIP); |
| 424 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | 424 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); |
| 425 label_fields.push_back(ADDRESS_HOME_COUNTRY); | 425 label_fields.push_back(ADDRESS_HOME_COUNTRY); |
|
please use gerrit instead
2016/11/18 21:56:22
Add a comment about missing NAME_FULL. The reader
sebsg
2016/11/21 16:07:09
Done.
| |
| 426 | 426 |
| 427 AutofillProfile profile; | 427 AutofillProfile profile; |
| 428 PopulateNativeProfileFromJava(jprofile, env, &profile); | 428 PopulateNativeProfileFromJava(jprofile, env, &profile); |
| 429 | 429 |
| 430 return ConvertUTF16ToJavaString( | 430 return ConvertUTF16ToJavaString( |
| 431 env, profile.ConstructInferredLabel( | 431 env, profile.ConstructInferredLabel( |
| 432 label_fields, label_fields.size(), | 432 label_fields, label_fields.size(), |
| 433 g_browser_process->GetApplicationLocale())); | 433 g_browser_process->GetApplicationLocale())); |
| 434 } | 434 } |
| 435 | 435 |
| 436 base::android::ScopedJavaLocalRef<jstring> | |
| 437 PersonalDataManagerAndroid::GetBillingAddressLabelForPaymentRequest( | |
| 438 JNIEnv* env, | |
| 439 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 440 const base::android::JavaParamRef<jobject>& jprofile) { | |
| 441 std::vector<ServerFieldType> label_fields; | |
| 442 label_fields.push_back(NAME_FULL); | |
| 443 label_fields.push_back(ADDRESS_HOME_LINE1); | |
| 444 label_fields.push_back(ADDRESS_HOME_LINE2); | |
| 445 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | |
| 446 label_fields.push_back(ADDRESS_HOME_CITY); | |
| 447 label_fields.push_back(ADDRESS_HOME_STATE); | |
| 448 label_fields.push_back(ADDRESS_HOME_ZIP); | |
| 449 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | |
|
please use gerrit instead
2016/11/18 21:56:22
Add a comment about missing company_name and addre
sebsg
2016/11/21 16:07:09
Done.
| |
| 450 | |
| 451 AutofillProfile profile; | |
| 452 PopulateNativeProfileFromJava(jprofile, env, &profile); | |
| 453 | |
| 454 return ConvertUTF16ToJavaString( | |
| 455 env, profile.ConstructInferredLabel( | |
| 456 label_fields, label_fields.size(), | |
| 457 g_browser_process->GetApplicationLocale())); | |
| 458 } | |
| 459 | |
| 436 base::android::ScopedJavaLocalRef<jobjectArray> | 460 base::android::ScopedJavaLocalRef<jobjectArray> |
| 437 PersonalDataManagerAndroid::GetCreditCardGUIDsForSettings( | 461 PersonalDataManagerAndroid::GetCreditCardGUIDsForSettings( |
| 438 JNIEnv* env, | 462 JNIEnv* env, |
| 439 const base::android::JavaParamRef<jobject>& unused_obj) { | 463 const base::android::JavaParamRef<jobject>& unused_obj) { |
| 440 return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCards()); | 464 return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCards()); |
| 441 } | 465 } |
| 442 | 466 |
| 443 base::android::ScopedJavaLocalRef<jobjectArray> | 467 base::android::ScopedJavaLocalRef<jobjectArray> |
| 444 PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( | 468 PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( |
| 445 JNIEnv* env, | 469 JNIEnv* env, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); | 884 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); |
| 861 } | 885 } |
| 862 | 886 |
| 863 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 887 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 864 PersonalDataManagerAndroid* personal_data_manager_android = | 888 PersonalDataManagerAndroid* personal_data_manager_android = |
| 865 new PersonalDataManagerAndroid(env, obj); | 889 new PersonalDataManagerAndroid(env, obj); |
| 866 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 890 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 867 } | 891 } |
| 868 | 892 |
| 869 } // namespace autofill | 893 } // namespace autofill |
| OLD | NEW |