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

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

Issue 2864363004: Adds UMA for days since previous use to help us determine the validity (Closed)
Patch Set: Created 3 years, 7 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 } 189 }
190 } 190 }
191 } 191 }
192 192
193 } // namespace 193 } // namespace
194 194
195 AutofillProfile::AutofillProfile(const std::string& guid, 195 AutofillProfile::AutofillProfile(const std::string& guid,
196 const std::string& origin) 196 const std::string& origin)
197 : AutofillDataModel(guid, origin), 197 : AutofillDataModel(guid, origin),
198 phone_number_(this),
198 record_type_(LOCAL_PROFILE), 199 record_type_(LOCAL_PROFILE),
199 phone_number_(this),
200 has_converted_(false) {} 200 has_converted_(false) {}
201 201
202 AutofillProfile::AutofillProfile(RecordType type, const std::string& server_id) 202 AutofillProfile::AutofillProfile(RecordType type, const std::string& server_id)
203 : AutofillDataModel(base::GenerateGUID(), std::string()), 203 : AutofillDataModel(base::GenerateGUID(), std::string()),
204 record_type_(type),
205 phone_number_(this), 204 phone_number_(this),
206 server_id_(server_id), 205 server_id_(server_id),
206 record_type_(type),
207 has_converted_(false) { 207 has_converted_(false) {
208 DCHECK(type == SERVER_PROFILE); 208 DCHECK(type == SERVER_PROFILE);
209 } 209 }
210 210
211 AutofillProfile::AutofillProfile() 211 AutofillProfile::AutofillProfile()
212 : AutofillDataModel(base::GenerateGUID(), std::string()), 212 : AutofillDataModel(base::GenerateGUID(), std::string()),
213 phone_number_(this),
213 record_type_(LOCAL_PROFILE), 214 record_type_(LOCAL_PROFILE),
214 phone_number_(this),
215 has_converted_(false) {} 215 has_converted_(false) {}
216 216
217 AutofillProfile::AutofillProfile(const AutofillProfile& profile) 217 AutofillProfile::AutofillProfile(const AutofillProfile& profile)
218 : AutofillDataModel(std::string(), std::string()), phone_number_(this) { 218 : AutofillDataModel(std::string(), std::string()), phone_number_(this) {
219 operator=(profile); 219 operator=(profile);
220 } 220 }
221 221
222 AutofillProfile::~AutofillProfile() { 222 AutofillProfile::~AutofillProfile() {
223 } 223 }
224 224
225 AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) { 225 AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) {
226 set_use_count(profile.use_count()); 226 set_use_count(profile.use_count());
227 set_use_date(profile.use_date()); 227 set_use_date(profile.use_date());
228 set_previous_use_date(profile.previous_use_date());
228 set_modification_date(profile.modification_date()); 229 set_modification_date(profile.modification_date());
229 230
230 if (this == &profile) 231 if (this == &profile)
231 return *this; 232 return *this;
232 233
233 set_guid(profile.guid()); 234 set_guid(profile.guid());
234 set_origin(profile.origin()); 235 set_origin(profile.origin());
235 236
236 record_type_ = profile.record_type_; 237 record_type_ = profile.record_type_;
237 238
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 contents.append(GetRawInfo(ADDRESS_HOME_ZIP)); 696 contents.append(GetRawInfo(ADDRESS_HOME_ZIP));
696 contents.append(GetRawInfo(ADDRESS_HOME_SORTING_CODE)); 697 contents.append(GetRawInfo(ADDRESS_HOME_SORTING_CODE));
697 contents.append(GetRawInfo(ADDRESS_HOME_COUNTRY)); 698 contents.append(GetRawInfo(ADDRESS_HOME_COUNTRY));
698 contents.append(GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 699 contents.append(GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
699 std::string contents_utf8 = UTF16ToUTF8(contents); 700 std::string contents_utf8 = UTF16ToUTF8(contents);
700 contents_utf8.append(language_code()); 701 contents_utf8.append(language_code());
701 server_id_ = base::SHA1HashString(contents_utf8); 702 server_id_ = base::SHA1HashString(contents_utf8);
702 } 703 }
703 704
704 void AutofillProfile::RecordAndLogUse() { 705 void AutofillProfile::RecordAndLogUse() {
706 previous_use_date_ = use_date();
705 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile", 707 UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile",
706 (AutofillClock::Now() - use_date()).InDays()); 708 (AutofillClock::Now() - use_date()).InDays());
707 RecordUse(); 709 RecordUse();
708 } 710 }
709 711
710 void AutofillProfile::GetSupportedTypes( 712 void AutofillProfile::GetSupportedTypes(
711 ServerFieldTypeSet* supported_types) const { 713 ServerFieldTypeSet* supported_types) const {
712 FormGroupList info = FormGroups(); 714 FormGroupList info = FormGroups();
713 for (const auto* form_group : info) { 715 for (const auto* form_group : info) {
714 form_group->GetSupportedTypes(supported_types); 716 form_group->GetSupportedTypes(supported_types);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 860 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
859 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 861 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
860 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 862 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
861 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 863 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
862 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 864 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
863 << profile.language_code() << " " 865 << profile.language_code() << " "
864 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 866 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
865 } 867 }
866 868
867 } // namespace autofill 869 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698