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 "components/autofill/core/browser/autofill_profile.h" | 5 #include "components/autofill/core/browser/autofill_profile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 | 246 |
| 247 return *this; | 247 return *this; |
| 248 } | 248 } |
| 249 | 249 |
| 250 // TODO(crbug.com/589535): Disambiguate similar field types before uploading. | 250 // TODO(crbug.com/589535): Disambiguate similar field types before uploading. |
| 251 void AutofillProfile::GetMatchingTypes( | 251 void AutofillProfile::GetMatchingTypes( |
| 252 const base::string16& text, | 252 const base::string16& text, |
| 253 const std::string& app_locale, | 253 const std::string& app_locale, |
| 254 ServerFieldTypeSet* matching_types) const { | 254 ServerFieldTypeSet* matching_types) const { |
| 255 FormGroupList info = FormGroups(); | 255 FormGroupList info = FormGroups(); |
| 256 for (const auto& it : info) { | 256 for (auto* it : info) { |
|
vabr (Chromium)
2016/07/19 07:54:08
optional nit: Since |it| is not an iterator, could
vabr (Chromium)
2016/07/19 07:54:08
nit: "const auto*" to emphasise the actual type of
vmpstr
2016/07/19 19:49:30
Done.
| |
| 257 it->GetMatchingTypes(text, app_locale, matching_types); | 257 it->GetMatchingTypes(text, app_locale, matching_types); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 base::string16 AutofillProfile::GetRawInfo(ServerFieldType type) const { | 261 base::string16 AutofillProfile::GetRawInfo(ServerFieldType type) const { |
| 262 const FormGroup* form_group = FormGroupForType(AutofillType(type)); | 262 const FormGroup* form_group = FormGroupForType(AutofillType(type)); |
| 263 if (!form_group) | 263 if (!form_group) |
| 264 return base::string16(); | 264 return base::string16(); |
| 265 | 265 |
| 266 return form_group->GetRawInfo(type); | 266 return form_group->GetRawInfo(type); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 691 | 691 |
| 692 void AutofillProfile::RecordAndLogUse() { | 692 void AutofillProfile::RecordAndLogUse() { |
| 693 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile", | 693 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile", |
| 694 (base::Time::Now() - use_date()).InDays()); | 694 (base::Time::Now() - use_date()).InDays()); |
| 695 RecordUse(); | 695 RecordUse(); |
| 696 } | 696 } |
| 697 | 697 |
| 698 void AutofillProfile::GetSupportedTypes( | 698 void AutofillProfile::GetSupportedTypes( |
| 699 ServerFieldTypeSet* supported_types) const { | 699 ServerFieldTypeSet* supported_types) const { |
| 700 FormGroupList info = FormGroups(); | 700 FormGroupList info = FormGroups(); |
| 701 for (const auto& it : info) { | 701 for (auto* it : info) { |
| 702 it->GetSupportedTypes(supported_types); | 702 it->GetSupportedTypes(supported_types); |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 | 705 |
| 706 // static | 706 // static |
| 707 void AutofillProfile::CreateInferredLabelsHelper( | 707 void AutofillProfile::CreateInferredLabelsHelper( |
| 708 const std::vector<AutofillProfile*>& profiles, | 708 const std::vector<AutofillProfile*>& profiles, |
| 709 const std::list<size_t>& indices, | 709 const std::list<size_t>& indices, |
| 710 const std::vector<ServerFieldType>& fields, | 710 const std::vector<ServerFieldType>& fields, |
| 711 size_t num_fields_to_include, | 711 size_t num_fields_to_include, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " | 846 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " |
| 847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " | 847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " |
| 848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " | 848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " |
| 849 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " | 849 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " |
| 850 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " | 850 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " |
| 851 << profile.language_code() << " " | 851 << profile.language_code() << " " |
| 852 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); | 852 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); |
| 853 } | 853 } |
| 854 | 854 |
| 855 } // namespace autofill | 855 } // namespace autofill |
| OLD | NEW |