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_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <limits> | 11 #include <limits> |
12 #include <map> | 12 #include <map> |
13 #include <set> | 13 #include <set> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/containers/adapters.h" | 19 #include "base/containers/adapters.h" |
20 #include "base/feature_list.h" | 20 #include "base/feature_list.h" |
21 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
22 #include "base/guid.h" | 22 #include "base/guid.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
25 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
| 26 #include "base/metrics/histogram_macros.h" |
26 #include "base/path_service.h" | 27 #include "base/path_service.h" |
27 #include "base/strings/string16.h" | 28 #include "base/strings/string16.h" |
28 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
29 #include "base/strings/string_piece.h" | 30 #include "base/strings/string_piece.h" |
30 #include "base/strings/string_split.h" | 31 #include "base/strings/string_split.h" |
31 #include "base/strings/string_util.h" | 32 #include "base/strings/string_util.h" |
32 #include "base/strings/utf_string_conversions.h" | 33 #include "base/strings/utf_string_conversions.h" |
33 #include "base/threading/sequenced_worker_pool.h" | 34 #include "base/threading/sequenced_worker_pool.h" |
34 #include "base/threading/thread_restrictions.h" | 35 #include "base/threading/thread_restrictions.h" |
35 #include "build/build_config.h" | 36 #include "build/build_config.h" |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 } | 1434 } |
1434 } | 1435 } |
1435 } | 1436 } |
1436 } | 1437 } |
1437 | 1438 |
1438 // If none of the candidate addresses have a zip, the candidate set is | 1439 // If none of the candidate addresses have a zip, the candidate set is |
1439 // invalid. | 1440 // invalid. |
1440 if (verified_zip.empty() && !candidate_profiles.empty()) | 1441 if (verified_zip.empty() && !candidate_profiles.empty()) |
1441 upload_decision_metrics |= AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE; | 1442 upload_decision_metrics |= AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE; |
1442 | 1443 |
1443 if (!upload_decision_metrics) | 1444 if (!upload_decision_metrics) { |
1444 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); | 1445 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); |
1445 | 1446 if (!has_modified_profile) |
| 1447 for (const AutofillProfile& profile : candidate_profiles) |
| 1448 UMA_HISTOGRAM_COUNTS_1000( |
| 1449 "Autofill.DaysSincePreviousUseAtSubmission.Profile", |
| 1450 (profile.use_date() - profile.previous_use_date()).InDays()); |
| 1451 } |
1446 return upload_decision_metrics; | 1452 return upload_decision_metrics; |
1447 } | 1453 } |
1448 | 1454 |
1449 void AutofillManager::CollectRapporSample( | 1455 void AutofillManager::CollectRapporSample( |
1450 const GURL& source_url, | 1456 const GURL& source_url, |
1451 const std::string& metric_name) const { | 1457 const std::string& metric_name) const { |
1452 if (source_url.is_valid() && client_->GetRapporServiceImpl()) { | 1458 if (source_url.is_valid() && client_->GetRapporServiceImpl()) { |
1453 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(), | 1459 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(), |
1454 metric_name, source_url); | 1460 metric_name, source_url); |
1455 } | 1461 } |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 #endif // ENABLE_FORM_DEBUG_DUMP | 2307 #endif // ENABLE_FORM_DEBUG_DUMP |
2302 | 2308 |
2303 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { | 2309 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { |
2304 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); | 2310 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); |
2305 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), | 2311 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), |
2306 pending_upload_request_url_, | 2312 pending_upload_request_url_, |
2307 upload_decision_metrics); | 2313 upload_decision_metrics); |
2308 } | 2314 } |
2309 | 2315 |
2310 } // namespace autofill | 2316 } // namespace autofill |
OLD | NEW |