Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: components/autofill/core/browser/autofill_profile.cc

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Added DCHECK Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 #include "components/autofill/core/browser/autofill_country.h" 26 #include "components/autofill/core/browser/autofill_country.h"
27 #include "components/autofill/core/browser/autofill_field.h" 27 #include "components/autofill/core/browser/autofill_field.h"
28 #include "components/autofill/core/browser/autofill_metrics.h" 28 #include "components/autofill/core/browser/autofill_metrics.h"
29 #include "components/autofill/core/browser/autofill_profile_comparator.h" 29 #include "components/autofill/core/browser/autofill_profile_comparator.h"
30 #include "components/autofill/core/browser/autofill_type.h" 30 #include "components/autofill/core/browser/autofill_type.h"
31 #include "components/autofill/core/browser/contact_info.h" 31 #include "components/autofill/core/browser/contact_info.h"
32 #include "components/autofill/core/browser/phone_number.h" 32 #include "components/autofill/core/browser/phone_number.h"
33 #include "components/autofill/core/browser/phone_number_i18n.h" 33 #include "components/autofill/core/browser/phone_number_i18n.h"
34 #include "components/autofill/core/browser/state_names.h" 34 #include "components/autofill/core/browser/state_names.h"
35 #include "components/autofill/core/browser/validation.h" 35 #include "components/autofill/core/browser/validation.h"
36 #include "components/autofill/core/common/autofill_clock.h"
36 #include "components/autofill/core/common/autofill_l10n_util.h" 37 #include "components/autofill/core/common/autofill_l10n_util.h"
37 #include "components/autofill/core/common/form_field_data.h" 38 #include "components/autofill/core/common/form_field_data.h"
38 #include "grit/components_strings.h" 39 #include "grit/components_strings.h"
39 #include "third_party/icu/source/common/unicode/uchar.h" 40 #include "third_party/icu/source/common/unicode/uchar.h"
40 #include "third_party/icu/source/common/unicode/utypes.h" 41 #include "third_party/icu/source/common/unicode/utypes.h"
41 #include "third_party/icu/source/i18n/unicode/translit.h" 42 #include "third_party/icu/source/i18n/unicode/translit.h"
42 #include "third_party/libaddressinput/chromium/addressinput_util.h" 43 #include "third_party/libaddressinput/chromium/addressinput_util.h"
43 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da ta.h" 44 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da ta.h"
44 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo rmatter.h" 45 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo rmatter.h"
45 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_me tadata.h" 46 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_me tadata.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 contents.append(GetRawInfo(ADDRESS_HOME_SORTING_CODE)); 696 contents.append(GetRawInfo(ADDRESS_HOME_SORTING_CODE));
696 contents.append(GetRawInfo(ADDRESS_HOME_COUNTRY)); 697 contents.append(GetRawInfo(ADDRESS_HOME_COUNTRY));
697 contents.append(GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 698 contents.append(GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
698 std::string contents_utf8 = UTF16ToUTF8(contents); 699 std::string contents_utf8 = UTF16ToUTF8(contents);
699 contents_utf8.append(language_code()); 700 contents_utf8.append(language_code());
700 server_id_ = base::SHA1HashString(contents_utf8); 701 server_id_ = base::SHA1HashString(contents_utf8);
701 } 702 }
702 703
703 void AutofillProfile::RecordAndLogUse() { 704 void AutofillProfile::RecordAndLogUse() {
704 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile", 705 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile",
705 (base::Time::Now() - use_date()).InDays()); 706 (AutofillClock::Now() - use_date()).InDays());
706 RecordUse(); 707 RecordUse();
707 } 708 }
708 709
709 void AutofillProfile::GetSupportedTypes( 710 void AutofillProfile::GetSupportedTypes(
710 ServerFieldTypeSet* supported_types) const { 711 ServerFieldTypeSet* supported_types) const {
711 FormGroupList info = FormGroups(); 712 FormGroupList info = FormGroups();
712 for (const auto* form_group : info) { 713 for (const auto* form_group : info) {
713 form_group->GetSupportedTypes(supported_types); 714 form_group->GetSupportedTypes(supported_types);
714 } 715 }
715 } 716 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 858 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
858 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 859 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
859 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 860 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
860 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 861 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
861 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 862 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
862 << profile.language_code() << " " 863 << profile.language_code() << " "
863 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 864 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
864 } 865 }
865 866
866 } // namespace autofill 867 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698