| 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> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 17 #include "base/time.h" | 18 #include "base/time.h" |
| 18 #include "chrome/browser/autofill/autofill_type.h" | 19 #include "chrome/browser/autofill/autofill_type.h" |
| 19 #include "content/common/net/url_fetcher.h" | 20 #include "content/public/common/url_fetcher_delegate.h" |
| 20 | 21 |
| 21 class AutofillMetrics; | 22 class AutofillMetrics; |
| 22 class FormStructure; | 23 class FormStructure; |
| 23 class GURL; | 24 class GURL; |
| 24 class Profile; | 25 class Profile; |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| 27 class URLRequestStatus; | 28 class URLRequestStatus; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Handles getting and updating Autofill heuristics. | 31 // Handles getting and updating Autofill heuristics. |
| 31 class AutofillDownloadManager : public URLFetcher::Delegate { | 32 class AutofillDownloadManager : public content::URLFetcherDelegate { |
| 32 public: | 33 public: |
| 33 enum AutofillRequestType { | 34 enum AutofillRequestType { |
| 34 REQUEST_QUERY, | 35 REQUEST_QUERY, |
| 35 REQUEST_UPLOAD, | 36 REQUEST_UPLOAD, |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 // An interface used to notify clients of AutofillDownloadManager. | 39 // An interface used to notify clients of AutofillDownloadManager. |
| 39 // Notifications are *not* guaranteed to be called. | 40 // Notifications are *not* guaranteed to be called. |
| 40 class Observer { | 41 class Observer { |
| 41 public: | 42 public: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void CacheQueryRequest(const std::vector<std::string>& forms_in_query, | 118 void CacheQueryRequest(const std::vector<std::string>& forms_in_query, |
| 118 const std::string& query_data); | 119 const std::string& query_data); |
| 119 // 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 |
| 120 // 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. |
| 121 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, | 122 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, |
| 122 std::string* query_data) const; | 123 std::string* query_data) const; |
| 123 // Concatenates |forms_in_query| into one signature. | 124 // Concatenates |forms_in_query| into one signature. |
| 124 std::string GetCombinedSignature( | 125 std::string GetCombinedSignature( |
| 125 const std::vector<std::string>& forms_in_query) const; | 126 const std::vector<std::string>& forms_in_query) const; |
| 126 | 127 |
| 127 // URLFetcher::Delegate implementation: | 128 // content::URLFetcherDelegate implementation: |
| 128 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 129 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; |
| 129 | 130 |
| 130 // 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). |
| 131 // GetPositiveUploadRate() is for matched forms, | 132 // GetPositiveUploadRate() is for matched forms, |
| 132 // GetNegativeUploadRate() for non-matched. | 133 // GetNegativeUploadRate() for non-matched. |
| 133 double GetPositiveUploadRate() const; | 134 double GetPositiveUploadRate() const; |
| 134 double GetNegativeUploadRate() const; | 135 double GetNegativeUploadRate() const; |
| 135 void SetPositiveUploadRate(double rate); | 136 void SetPositiveUploadRate(double rate); |
| 136 void SetNegativeUploadRate(double rate); | 137 void SetNegativeUploadRate(double rate); |
| 137 | 138 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 157 // |positive_upload_rate_| is for matched forms, | 158 // |positive_upload_rate_| is for matched forms, |
| 158 // |negative_upload_rate_| for non matched. | 159 // |negative_upload_rate_| for non matched. |
| 159 double positive_upload_rate_; | 160 double positive_upload_rate_; |
| 160 double negative_upload_rate_; | 161 double negative_upload_rate_; |
| 161 | 162 |
| 162 // Needed for unit-test. | 163 // Needed for unit-test. |
| 163 int fetcher_id_for_unittest_; | 164 int fetcher_id_for_unittest_; |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 167 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
| OLD | NEW |