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