| 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/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "chrome/browser/autofill/autofill_type.h" |
| 18 #include "chrome/common/net/url_fetcher.h" | 19 #include "chrome/common/net/url_fetcher.h" |
| 19 | 20 |
| 20 class AutofillMetrics; | 21 class AutofillMetrics; |
| 21 class FormStructure; | 22 class FormStructure; |
| 22 class GURL; | 23 class GURL; |
| 23 class Profile; | 24 class Profile; |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 class URLRequestStatus; | 27 class URLRequestStatus; |
| 27 } | 28 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 65 |
| 65 // |observer| - observer to notify on successful completion or error. | 66 // |observer| - observer to notify on successful completion or error. |
| 66 void SetObserver(AutofillDownloadManager::Observer *observer); | 67 void SetObserver(AutofillDownloadManager::Observer *observer); |
| 67 | 68 |
| 68 // Starts a query request to Autofill servers. The observer is called with the | 69 // Starts a query request to Autofill servers. The observer is called with the |
| 69 // list of the fields of all requested forms. | 70 // list of the fields of all requested forms. |
| 70 // |forms| - array of forms aggregated in this request. | 71 // |forms| - array of forms aggregated in this request. |
| 71 bool StartQueryRequest(const ScopedVector<FormStructure>& forms, | 72 bool StartQueryRequest(const ScopedVector<FormStructure>& forms, |
| 72 const AutofillMetrics& metric_logger); | 73 const AutofillMetrics& metric_logger); |
| 73 | 74 |
| 74 // Start upload request if necessary. The probability of request going | 75 // Starts an upload request for the given |form|, unless throttled by the |
| 75 // over the wire are GetPositiveUploadRate() if it was matched by | 76 // server. The probability of the request going over the wire is |
| 76 // Autofill, GetNegativeUploadRate() otherwise. Observer will be called | 77 // GetPositiveUploadRate() if |form_was_autofilled| is true, or |
| 77 // even if there was no actual trip over the wire. | 78 // GetNegativeUploadRate() otherwise. The observer will be called even if |
| 78 // |form| - form sent in this request. | 79 // there was no actual trip over the wire. |
| 79 // |form_was_matched| - true if form was matched by the Autofill. | 80 // |available_field_types| should contain the types for which we have data |
| 80 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); | 81 // stored on the local client. |
| 82 bool StartUploadRequest(const FormStructure& form, |
| 83 bool form_was_autofilled, |
| 84 const FieldTypeSet& available_field_types); |
| 81 | 85 |
| 82 // Cancels pending request. | 86 // Cancels pending request. |
| 83 // |form_signature| - signature of the form being cancelled. Warning: | 87 // |form_signature| - signature of the form being cancelled. Warning: |
| 84 // for query request if more than one form sent in the request, all other | 88 // for query request if more than one form sent in the request, all other |
| 85 // forms will be cancelled as well. | 89 // forms will be cancelled as well. |
| 86 // |request_type| - type of the request. | 90 // |request_type| - type of the request. |
| 87 bool CancelRequest(const std::string& form_signature, | 91 bool CancelRequest(const std::string& form_signature, |
| 88 AutofillRequestType request_type); | 92 AutofillRequestType request_type); |
| 89 | 93 |
| 90 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). | 94 // Probability of the form upload. Between 0 (no upload) and 1 (upload all). |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // |negative_upload_rate_| for non matched. | 168 // |negative_upload_rate_| for non matched. |
| 165 double positive_upload_rate_; | 169 double positive_upload_rate_; |
| 166 double negative_upload_rate_; | 170 double negative_upload_rate_; |
| 167 | 171 |
| 168 // Needed for unit-test. | 172 // Needed for unit-test. |
| 169 int fetcher_id_for_unittest_; | 173 int fetcher_id_for_unittest_; |
| 170 }; | 174 }; |
| 171 | 175 |
| 172 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 176 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
| 173 | 177 |
| OLD | NEW |