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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/scoped_vector.h" | 12 #include "base/scoped_vector.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "chrome/browser/autofill/autofill_profile.h" | 14 #include "chrome/browser/autofill/autofill_profile.h" |
15 #include "chrome/browser/autofill/field_types.h" | 15 #include "chrome/browser/autofill/field_types.h" |
16 #include "chrome/browser/autofill/form_structure.h" | 16 #include "chrome/browser/autofill/form_structure.h" |
17 #include "chrome/common/net/url_fetcher.h" | 17 #include "chrome/common/net/url_fetcher.h" |
18 | 18 |
19 class AutoFillServerQueryMetricLogger; | |
dhollowa
2010/12/12 07:07:51
Wow, long name... How about AutoFillMetrics?
Ilya Sherman
2010/12/13 22:13:51
Done.
| |
19 class Profile; | 20 class Profile; |
20 | 21 |
21 // Handles getting and updating AutoFill heuristics. | 22 // Handles getting and updating AutoFill heuristics. |
22 class AutoFillDownloadManager : public URLFetcher::Delegate { | 23 class AutoFillDownloadManager : public URLFetcher::Delegate { |
23 public: | 24 public: |
24 enum AutoFillRequestType { | 25 enum AutoFillRequestType { |
25 REQUEST_QUERY, | 26 REQUEST_QUERY, |
26 REQUEST_UPLOAD, | 27 REQUEST_UPLOAD, |
27 }; | 28 }; |
28 | 29 |
(...skipping 24 matching lines...) Expand all Loading... | |
53 // |profile| can be NULL in unit-tests only. | 54 // |profile| can be NULL in unit-tests only. |
54 explicit AutoFillDownloadManager(Profile* profile); | 55 explicit AutoFillDownloadManager(Profile* profile); |
55 virtual ~AutoFillDownloadManager(); | 56 virtual ~AutoFillDownloadManager(); |
56 | 57 |
57 // |observer| - observer to notify on successful completion or error. | 58 // |observer| - observer to notify on successful completion or error. |
58 void SetObserver(AutoFillDownloadManager::Observer *observer); | 59 void SetObserver(AutoFillDownloadManager::Observer *observer); |
59 | 60 |
60 // Starts a query request to AutoFill servers. The observer is called with the | 61 // Starts a query request to AutoFill servers. The observer is called with the |
61 // list of the fields of all requested forms. | 62 // list of the fields of all requested forms. |
62 // |forms| - array of forms aggregated in this request. | 63 // |forms| - array of forms aggregated in this request. |
63 bool StartQueryRequest(const ScopedVector<FormStructure>& forms); | 64 bool StartQueryRequest( |
65 const ScopedVector<FormStructure>& forms, | |
66 const AutoFillServerQueryMetricLogger& server_query_metric_logger); | |
64 | 67 |
65 // Start upload request if necessary. The probability of request going | 68 // Start upload request if necessary. The probability of request going |
66 // over the wire are GetPositiveUploadRate() if it was matched by | 69 // over the wire are GetPositiveUploadRate() if it was matched by |
67 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called | 70 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called |
68 // even if there was no actual trip over the wire. | 71 // even if there was no actual trip over the wire. |
69 // |form| - form sent in this request. | 72 // |form| - form sent in this request. |
70 // |form_was_matched| - true if form was matched by the AutoFill. | 73 // |form_was_matched| - true if form was matched by the AutoFill. |
71 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); | 74 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); |
72 | 75 |
73 // Cancels pending request. | 76 // Cancels pending request. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 double positive_upload_rate_; | 135 double positive_upload_rate_; |
133 double negative_upload_rate_; | 136 double negative_upload_rate_; |
134 | 137 |
135 // Needed for unit-test. | 138 // Needed for unit-test. |
136 int fetcher_id_for_unittest_; | 139 int fetcher_id_for_unittest_; |
137 bool is_testing_; | 140 bool is_testing_; |
138 }; | 141 }; |
139 | 142 |
140 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 143 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
141 | 144 |
OLD | NEW |