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 "components/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
| 11 #include "base/command_line.h" |
11 #include "base/i18n/timezone.h" | 12 #include "base/i18n/timezone.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
18 #include "components/autofill/core/browser/address_i18n.h" | 19 #include "components/autofill/core/browser/address_i18n.h" |
19 #include "components/autofill/core/browser/autofill-inl.h" | 20 #include "components/autofill/core/browser/autofill-inl.h" |
20 #include "components/autofill/core/browser/autofill_country.h" | 21 #include "components/autofill/core/browser/autofill_country.h" |
21 #include "components/autofill/core/browser/autofill_field.h" | 22 #include "components/autofill/core/browser/autofill_field.h" |
22 #include "components/autofill/core/browser/autofill_metrics.h" | 23 #include "components/autofill/core/browser/autofill_metrics.h" |
23 #include "components/autofill/core/browser/form_structure.h" | 24 #include "components/autofill/core/browser/form_structure.h" |
24 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 25 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
25 #include "components/autofill/core/browser/phone_number.h" | 26 #include "components/autofill/core/browser/phone_number.h" |
26 #include "components/autofill/core/browser/phone_number_i18n.h" | 27 #include "components/autofill/core/browser/phone_number_i18n.h" |
27 #include "components/autofill/core/browser/validation.h" | 28 #include "components/autofill/core/browser/validation.h" |
28 #include "components/autofill/core/common/autofill_pref_names.h" | 29 #include "components/autofill/core/common/autofill_pref_names.h" |
| 30 #include "components/autofill/core/common/autofill_switches.h" |
29 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" | 31 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" |
30 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" | 32 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" |
31 | 33 |
32 namespace autofill { | 34 namespace autofill { |
33 namespace { | 35 namespace { |
34 | 36 |
35 using ::i18n::addressinput::AddressField; | 37 using ::i18n::addressinput::AddressField; |
36 using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine; | 38 using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine; |
37 using ::i18n::addressinput::STREET_ADDRESS; | 39 using ::i18n::addressinput::STREET_ADDRESS; |
38 | 40 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 } | 652 } |
651 | 653 |
652 const std::vector<AutofillProfile*>& PersonalDataManager::web_profiles() const { | 654 const std::vector<AutofillProfile*>& PersonalDataManager::web_profiles() const { |
653 return web_profiles_.get(); | 655 return web_profiles_.get(); |
654 } | 656 } |
655 | 657 |
656 const std::vector<CreditCard*>& PersonalDataManager::GetCreditCards() const { | 658 const std::vector<CreditCard*>& PersonalDataManager::GetCreditCards() const { |
657 credit_cards_.clear(); | 659 credit_cards_.clear(); |
658 credit_cards_.insert(credit_cards_.end(), local_credit_cards_.begin(), | 660 credit_cards_.insert(credit_cards_.end(), local_credit_cards_.begin(), |
659 local_credit_cards_.end()); | 661 local_credit_cards_.end()); |
660 credit_cards_.insert(credit_cards_.end(), server_credit_cards_.begin(), | 662 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
661 server_credit_cards_.end()); | 663 switches::kEnableWalletCardImport)) { |
| 664 credit_cards_.insert(credit_cards_.end(), server_credit_cards_.begin(), |
| 665 server_credit_cards_.end()); |
| 666 } |
662 return credit_cards_; | 667 return credit_cards_; |
663 } | 668 } |
664 | 669 |
665 void PersonalDataManager::Refresh() { | 670 void PersonalDataManager::Refresh() { |
666 LoadProfiles(); | 671 LoadProfiles(); |
667 LoadCreditCards(); | 672 LoadCreditCards(); |
668 } | 673 } |
669 | 674 |
670 std::vector<Suggestion> PersonalDataManager::GetProfileSuggestions( | 675 std::vector<Suggestion> PersonalDataManager::GetProfileSuggestions( |
671 const AutofillType& type, | 676 const AutofillType& type, |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 | 1194 |
1190 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); | 1195 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); |
1191 profiles_.insert( | 1196 profiles_.insert( |
1192 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); | 1197 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); |
1193 profiles_.insert( | 1198 profiles_.insert( |
1194 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1199 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
1195 return profiles_; | 1200 return profiles_; |
1196 } | 1201 } |
1197 | 1202 |
1198 } // namespace autofill | 1203 } // namespace autofill |
OLD | NEW |