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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 std::vector<ServerFieldType> label_fields; | 376 std::vector<ServerFieldType> label_fields; |
377 label_fields.push_back(COMPANY_NAME); | 377 label_fields.push_back(COMPANY_NAME); |
378 label_fields.push_back(ADDRESS_HOME_LINE1); | 378 label_fields.push_back(ADDRESS_HOME_LINE1); |
379 label_fields.push_back(ADDRESS_HOME_LINE2); | 379 label_fields.push_back(ADDRESS_HOME_LINE2); |
380 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | 380 label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); |
381 label_fields.push_back(ADDRESS_HOME_CITY); | 381 label_fields.push_back(ADDRESS_HOME_CITY); |
382 label_fields.push_back(ADDRESS_HOME_STATE); | 382 label_fields.push_back(ADDRESS_HOME_STATE); |
383 label_fields.push_back(ADDRESS_HOME_ZIP); | 383 label_fields.push_back(ADDRESS_HOME_ZIP); |
384 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); | 384 label_fields.push_back(ADDRESS_HOME_SORTING_CODE); |
385 label_fields.push_back(ADDRESS_HOME_COUNTRY); | 385 label_fields.push_back(ADDRESS_HOME_COUNTRY); |
386 label_fields.push_back(PHONE_HOME_WHOLE_NUMBER); | |
387 | 386 |
388 AutofillProfile profile; | 387 AutofillProfile profile; |
389 PopulateNativeProfileFromJava(jprofile, env, &profile); | 388 PopulateNativeProfileFromJava(jprofile, env, &profile); |
390 | 389 |
391 return ConvertUTF16ToJavaString( | 390 return ConvertUTF16ToJavaString( |
392 env, profile.ConstructInferredLabel( | 391 env, profile.ConstructInferredLabel( |
393 label_fields, label_fields.size(), | 392 label_fields, label_fields.size(), |
394 g_browser_process->GetApplicationLocale())); | 393 g_browser_process->GetApplicationLocale())); |
395 } | 394 } |
396 | 395 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 suggested_fields.reset(new std::vector<ServerFieldType>); | 621 suggested_fields.reset(new std::vector<ServerFieldType>); |
623 suggested_fields->push_back(COMPANY_NAME); | 622 suggested_fields->push_back(COMPANY_NAME); |
624 suggested_fields->push_back(ADDRESS_HOME_LINE1); | 623 suggested_fields->push_back(ADDRESS_HOME_LINE1); |
625 suggested_fields->push_back(ADDRESS_HOME_LINE2); | 624 suggested_fields->push_back(ADDRESS_HOME_LINE2); |
626 suggested_fields->push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); | 625 suggested_fields->push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); |
627 suggested_fields->push_back(ADDRESS_HOME_CITY); | 626 suggested_fields->push_back(ADDRESS_HOME_CITY); |
628 suggested_fields->push_back(ADDRESS_HOME_STATE); | 627 suggested_fields->push_back(ADDRESS_HOME_STATE); |
629 suggested_fields->push_back(ADDRESS_HOME_ZIP); | 628 suggested_fields->push_back(ADDRESS_HOME_ZIP); |
630 suggested_fields->push_back(ADDRESS_HOME_SORTING_CODE); | 629 suggested_fields->push_back(ADDRESS_HOME_SORTING_CODE); |
631 suggested_fields->push_back(ADDRESS_HOME_COUNTRY); | 630 suggested_fields->push_back(ADDRESS_HOME_COUNTRY); |
632 suggested_fields->push_back(PHONE_HOME_WHOLE_NUMBER); | |
633 minimal_fields_shown = suggested_fields->size(); | 631 minimal_fields_shown = suggested_fields->size(); |
634 } | 632 } |
635 | 633 |
636 std::vector<base::string16> labels; | 634 std::vector<base::string16> labels; |
637 AutofillProfile::CreateInferredLabels( | 635 AutofillProfile::CreateInferredLabels( |
638 profiles, suggested_fields.get(), NAME_FULL, minimal_fields_shown, | 636 profiles, suggested_fields.get(), NAME_FULL, minimal_fields_shown, |
639 g_browser_process->GetApplicationLocale(), &labels); | 637 g_browser_process->GetApplicationLocale(), &labels); |
640 | 638 |
641 return base::android::ToJavaArrayOfStrings(env, labels); | 639 return base::android::ToJavaArrayOfStrings(env, labels); |
642 } | 640 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); | 683 base::android::ConvertJavaStringToUTF16(env, jcountry_name))); |
686 } | 684 } |
687 | 685 |
688 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 686 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
689 PersonalDataManagerAndroid* personal_data_manager_android = | 687 PersonalDataManagerAndroid* personal_data_manager_android = |
690 new PersonalDataManagerAndroid(env, obj); | 688 new PersonalDataManagerAndroid(env, obj); |
691 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 689 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
692 } | 690 } |
693 | 691 |
694 } // namespace autofill | 692 } // namespace autofill |
OLD | NEW |