OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/autofill/autofill_download.h" | 5 #include "chrome/browser/autofill/autofill_download.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 AutoFillDownloadManager::Observer *observer) { | 60 AutoFillDownloadManager::Observer *observer) { |
61 if (observer) { | 61 if (observer) { |
62 DCHECK(!observer_); | 62 DCHECK(!observer_); |
63 observer_ = observer; | 63 observer_ = observer; |
64 } else { | 64 } else { |
65 observer_ = NULL; | 65 observer_ = NULL; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 bool AutoFillDownloadManager::StartQueryRequest( | 69 bool AutoFillDownloadManager::StartQueryRequest( |
70 const ScopedVector<FormStructure>& forms) { | 70 const ScopedVector<FormStructure>& forms, |
| 71 const AutoFillMetrics& metric_logger) { |
71 if (next_query_request_ > base::Time::Now()) { | 72 if (next_query_request_ > base::Time::Now()) { |
72 // We are in back-off mode: do not do the request. | 73 // We are in back-off mode: do not do the request. |
73 return false; | 74 return false; |
74 } | 75 } |
75 std::string form_xml; | 76 std::string form_xml; |
76 FormRequestData request_data; | 77 FormRequestData request_data; |
77 if (!FormStructure::EncodeQueryRequest(forms, &request_data.form_signatures, | 78 if (!FormStructure::EncodeQueryRequest(forms, &request_data.form_signatures, |
78 &form_xml)) | 79 &form_xml)) |
79 return false; | 80 return false; |
80 | 81 |
81 request_data.request_type = AutoFillDownloadManager::REQUEST_QUERY; | 82 request_data.request_type = AutoFillDownloadManager::REQUEST_QUERY; |
82 autofill_metrics::LogServerQueryMetric(autofill_metrics::QUERY_SENT); | 83 metric_logger.Log(AutoFillMetrics::QUERY_SENT); |
83 | 84 |
84 return StartRequest(form_xml, request_data); | 85 return StartRequest(form_xml, request_data); |
85 } | 86 } |
86 | 87 |
87 bool AutoFillDownloadManager::StartUploadRequest( | 88 bool AutoFillDownloadManager::StartUploadRequest( |
88 const FormStructure& form, bool form_was_matched) { | 89 const FormStructure& form, bool form_was_matched) { |
89 if (next_upload_request_ > base::Time::Now()) { | 90 if (next_upload_request_ > base::Time::Now()) { |
90 // We are in back-off mode: do not do the request. | 91 // We are in back-off mode: do not do the request. |
91 return false; | 92 return false; |
92 } | 93 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 SetNegativeUploadRate(new_negative_upload_rate); | 263 SetNegativeUploadRate(new_negative_upload_rate); |
263 } | 264 } |
264 | 265 |
265 if (observer_) | 266 if (observer_) |
266 observer_->OnUploadedAutoFillHeuristics(it->second.form_signatures[0]); | 267 observer_->OnUploadedAutoFillHeuristics(it->second.form_signatures[0]); |
267 } | 268 } |
268 } | 269 } |
269 delete it->first; | 270 delete it->first; |
270 url_fetchers_.erase(it); | 271 url_fetchers_.erase(it); |
271 } | 272 } |
OLD | NEW |