Index: components/autofill/browser/autocheckout/whitelist_manager.cc |
diff --git a/components/autofill/browser/autocheckout/whitelist_manager.cc b/components/autofill/browser/autocheckout/whitelist_manager.cc |
index aeb60f113393bfbe12ee93af31708c6632f2588a..583c7e33e1554a7bc7d2cb6147234963b1cce925 100644 |
--- a/components/autofill/browser/autocheckout/whitelist_manager.cc |
+++ b/components/autofill/browser/autocheckout/whitelist_manager.cc |
@@ -55,6 +55,10 @@ void WhitelistManager::Init(net::URLRequestContextGetter* context_getter) { |
ScheduleDownload(kInitialDownloadDelaySeconds); |
} |
+const AutofillMetrics& WhitelistManager::GetMetricLogger() const { |
+ return metrics_logger_; |
+} |
Ilya Sherman
2013/04/17 05:01:48
nit: Please order this so that its sorted the same
benquan
2013/04/17 05:48:18
Done.
|
+ |
void WhitelistManager::ScheduleDownload(size_t interval_seconds) { |
if (!experimental_form_filling_enabled_) { |
// The feature is not enabled: do not do the request. |
@@ -77,6 +81,8 @@ void WhitelistManager::StartDownloadTimer(size_t interval_seconds) { |
void WhitelistManager::TriggerDownload() { |
callback_is_pending_ = true; |
+ request_started_timestamp_ = base::Time::Now(); |
+ |
request_.reset(net::URLFetcher::Create( |
0, GURL(kWhitelistUrl), net::URLFetcher::GET, this)); |
request_->SetRequestContext(context_getter_); |
@@ -99,9 +105,16 @@ void WhitelistManager::OnURLFetchComplete( |
DCHECK_EQ(source, old_request.get()); |
if (source->GetResponseCode() == net::HTTP_OK) { |
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration( |
+ base::Time::Now() - request_started_timestamp_, |
+ AutofillMetrics::AUTOCHECKOUT_WHITELIST_DOWNLOAD_SUCCEEDED); |
std::string data; |
source->GetResponseAsString(&data); |
BuildWhitelist(data); |
+ } else { |
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration( |
+ base::Time::Now() - request_started_timestamp_, |
+ AutofillMetrics::AUTOCHECKOUT_WHITELIST_DOWNLOAD_FAILED); |
} |
ScheduleDownload(kDownloadIntervalSeconds); |