OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stddef.h> | 9 #include <stddef.h> |
10 #include <list> | 10 #include <list> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const std::string& query_data); | 119 const std::string& query_data); |
120 // Returns true if query is in the cache, while filling |query_data|, false | 120 // Returns true if query is in the cache, while filling |query_data|, false |
121 // otherwise. |forms_in_query| is a vector of form signatures in the query. | 121 // otherwise. |forms_in_query| is a vector of form signatures in the query. |
122 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, | 122 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, |
123 std::string* query_data) const; | 123 std::string* query_data) const; |
124 // Concatenates |forms_in_query| into one signature. | 124 // Concatenates |forms_in_query| into one signature. |
125 std::string GetCombinedSignature( | 125 std::string GetCombinedSignature( |
126 const std::vector<std::string>& forms_in_query) const; | 126 const std::vector<std::string>& forms_in_query) const; |
127 | 127 |
128 // content::URLFetcherDelegate implementation: | 128 // content::URLFetcherDelegate implementation: |
129 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 129 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
130 | 130 |
131 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). | 131 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). |
132 // GetPositiveUploadRate() is for matched forms, | 132 // GetPositiveUploadRate() is for matched forms, |
133 // GetNegativeUploadRate() for non-matched. | 133 // GetNegativeUploadRate() for non-matched. |
134 double GetPositiveUploadRate() const; | 134 double GetPositiveUploadRate() const; |
135 double GetNegativeUploadRate() const; | 135 double GetNegativeUploadRate() const; |
136 void SetPositiveUploadRate(double rate); | 136 void SetPositiveUploadRate(double rate); |
137 void SetNegativeUploadRate(double rate); | 137 void SetNegativeUploadRate(double rate); |
138 | 138 |
139 // Profile for preference storage. | 139 // Profile for preference storage. |
140 Profile* profile_; | 140 Profile* profile_; |
141 | 141 |
142 // For each requested form for both query and upload we create a separate | 142 // For each requested form for both query and upload we create a separate |
143 // request and save its info. As url fetcher is identified by its address | 143 // request and save its info. As url fetcher is identified by its address |
144 // we use a map between fetchers and info. | 144 // we use a map between fetchers and info. |
145 std::map<URLFetcher*, FormRequestData> url_fetchers_; | 145 std::map<content::URLFetcher*, FormRequestData> url_fetchers_; |
146 AutofillDownloadManager::Observer *observer_; | 146 AutofillDownloadManager::Observer *observer_; |
147 | 147 |
148 // Cached QUERY requests. | 148 // Cached QUERY requests. |
149 QueryRequestCache cached_forms_; | 149 QueryRequestCache cached_forms_; |
150 size_t max_form_cache_size_; | 150 size_t max_form_cache_size_; |
151 | 151 |
152 // Time when next query/upload requests are allowed. If 50x HTTP received, | 152 // Time when next query/upload requests are allowed. If 50x HTTP received, |
153 // exponential back off is initiated, so this times will be in the future | 153 // exponential back off is initiated, so this times will be in the future |
154 // for awhile. | 154 // for awhile. |
155 base::Time next_query_request_; | 155 base::Time next_query_request_; |
156 base::Time next_upload_request_; | 156 base::Time next_upload_request_; |
157 | 157 |
158 // |positive_upload_rate_| is for matched forms, | 158 // |positive_upload_rate_| is for matched forms, |
159 // |negative_upload_rate_| for non matched. | 159 // |negative_upload_rate_| for non matched. |
160 double positive_upload_rate_; | 160 double positive_upload_rate_; |
161 double negative_upload_rate_; | 161 double negative_upload_rate_; |
162 | 162 |
163 // Needed for unit-test. | 163 // Needed for unit-test. |
164 int fetcher_id_for_unittest_; | 164 int fetcher_id_for_unittest_; |
165 }; | 165 }; |
166 | 166 |
167 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 167 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
OLD | NEW |