| 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 AutoFillMetrics; |
| 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(const ScopedVector<FormStructure>& forms, |
| 65 const AutoFillMetrics& metric_logger); |
| 64 | 66 |
| 65 // Start upload request if necessary. The probability of request going | 67 // Start upload request if necessary. The probability of request going |
| 66 // over the wire are GetPositiveUploadRate() if it was matched by | 68 // over the wire are GetPositiveUploadRate() if it was matched by |
| 67 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called | 69 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called |
| 68 // even if there was no actual trip over the wire. | 70 // even if there was no actual trip over the wire. |
| 69 // |form| - form sent in this request. | 71 // |form| - form sent in this request. |
| 70 // |form_was_matched| - true if form was matched by the AutoFill. | 72 // |form_was_matched| - true if form was matched by the AutoFill. |
| 71 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); | 73 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); |
| 72 | 74 |
| 73 // Cancels pending request. | 75 // Cancels pending request. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 double positive_upload_rate_; | 134 double positive_upload_rate_; |
| 133 double negative_upload_rate_; | 135 double negative_upload_rate_; |
| 134 | 136 |
| 135 // Needed for unit-test. | 137 // Needed for unit-test. |
| 136 int fetcher_id_for_unittest_; | 138 int fetcher_id_for_unittest_; |
| 137 bool is_testing_; | 139 bool is_testing_; |
| 138 }; | 140 }; |
| 139 | 141 |
| 140 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 142 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
| 141 | 143 |
| OLD | NEW |