| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "chrome/browser/autofill/autofill_type.h" | 19 #include "chrome/browser/autofill/autofill_type.h" |
| 20 #include "content/public/common/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 21 | 21 |
| 22 class AutofillMetrics; | 22 class AutofillMetrics; |
| 23 class FormStructure; | 23 class FormStructure; |
| 24 class Profile; | 24 class Profile; |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 class URLFetcher; | 27 class URLFetcher; |
| 28 } // namespace net | 28 } // namespace net |
| 29 | 29 |
| 30 // Handles getting and updating Autofill heuristics. | 30 // Handles getting and updating Autofill heuristics. |
| 31 class AutofillDownloadManager : public content::URLFetcherDelegate { | 31 class AutofillDownloadManager : public net::URLFetcherDelegate { |
| 32 public: | 32 public: |
| 33 enum AutofillRequestType { | 33 enum AutofillRequestType { |
| 34 REQUEST_QUERY, | 34 REQUEST_QUERY, |
| 35 REQUEST_UPLOAD, | 35 REQUEST_UPLOAD, |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // An interface used to notify clients of AutofillDownloadManager. | 38 // An interface used to notify clients of AutofillDownloadManager. |
| 39 class Observer { | 39 class Observer { |
| 40 public: | 40 public: |
| 41 // Called when field type predictions are successfully received from the | 41 // Called when field type predictions are successfully received from the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void CacheQueryRequest(const std::vector<std::string>& forms_in_query, | 107 void CacheQueryRequest(const std::vector<std::string>& forms_in_query, |
| 108 const std::string& query_data); | 108 const std::string& query_data); |
| 109 // Returns true if query is in the cache, while filling |query_data|, false | 109 // Returns true if query is in the cache, while filling |query_data|, false |
| 110 // otherwise. |forms_in_query| is a vector of form signatures in the query. | 110 // otherwise. |forms_in_query| is a vector of form signatures in the query. |
| 111 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, | 111 bool CheckCacheForQueryRequest(const std::vector<std::string>& forms_in_query, |
| 112 std::string* query_data) const; | 112 std::string* query_data) const; |
| 113 // Concatenates |forms_in_query| into one signature. | 113 // Concatenates |forms_in_query| into one signature. |
| 114 std::string GetCombinedSignature( | 114 std::string GetCombinedSignature( |
| 115 const std::vector<std::string>& forms_in_query) const; | 115 const std::vector<std::string>& forms_in_query) const; |
| 116 | 116 |
| 117 // content::URLFetcherDelegate implementation: | 117 // net::URLFetcherDelegate implementation: |
| 118 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 118 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 119 | 119 |
| 120 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). | 120 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). |
| 121 // GetPositiveUploadRate() is for matched forms, | 121 // GetPositiveUploadRate() is for matched forms, |
| 122 // GetNegativeUploadRate() for non-matched. | 122 // GetNegativeUploadRate() for non-matched. |
| 123 double GetPositiveUploadRate() const; | 123 double GetPositiveUploadRate() const; |
| 124 double GetNegativeUploadRate() const; | 124 double GetNegativeUploadRate() const; |
| 125 void SetPositiveUploadRate(double rate); | 125 void SetPositiveUploadRate(double rate); |
| 126 void SetNegativeUploadRate(double rate); | 126 void SetNegativeUploadRate(double rate); |
| 127 | 127 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 151 // |positive_upload_rate_| is for matched forms, | 151 // |positive_upload_rate_| is for matched forms, |
| 152 // |negative_upload_rate_| for non matched. | 152 // |negative_upload_rate_| for non matched. |
| 153 double positive_upload_rate_; | 153 double positive_upload_rate_; |
| 154 double negative_upload_rate_; | 154 double negative_upload_rate_; |
| 155 | 155 |
| 156 // Needed for unit-test. | 156 // Needed for unit-test. |
| 157 int fetcher_id_for_unittest_; | 157 int fetcher_id_for_unittest_; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 160 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
| OLD | NEW |