| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // |driver| and |pref_service| must outlive this instance. | 60 // |driver| and |pref_service| must outlive this instance. |
| 61 // |observer| - observer to notify on successful completion or error. | 61 // |observer| - observer to notify on successful completion or error. |
| 62 AutofillDownloadManager(AutofillDriver* driver, | 62 AutofillDownloadManager(AutofillDriver* driver, |
| 63 PrefService* pref_service, | 63 PrefService* pref_service, |
| 64 Observer* observer); | 64 Observer* observer); |
| 65 ~AutofillDownloadManager() override; | 65 ~AutofillDownloadManager() override; |
| 66 | 66 |
| 67 // Starts a query request to Autofill servers. The observer is called with the | 67 // Starts a query request to Autofill servers. The observer is called with the |
| 68 // list of the fields of all requested forms. | 68 // list of the fields of all requested forms. |
| 69 // |forms| - array of forms aggregated in this request. | 69 // |forms| - array of forms aggregated in this request. |
| 70 bool StartQueryRequest(const std::vector<FormStructure*>& forms); | 70 virtual bool StartQueryRequest(const std::vector<FormStructure*>& forms); |
| 71 | 71 |
| 72 // Starts an upload request for the given |form|, unless throttled by the | 72 // Starts an upload request for the given |form|, unless throttled by the |
| 73 // server. The probability of the request going over the wire is | 73 // server. The probability of the request going over the wire is |
| 74 // GetPositiveUploadRate() if |form_was_autofilled| is true, or | 74 // GetPositiveUploadRate() if |form_was_autofilled| is true, or |
| 75 // GetNegativeUploadRate() otherwise. The observer will be called even if | 75 // GetNegativeUploadRate() otherwise. The observer will be called even if |
| 76 // there was no actual trip over the wire. | 76 // there was no actual trip over the wire. |
| 77 // |available_field_types| should contain the types for which we have data | 77 // |available_field_types| should contain the types for which we have data |
| 78 // stored on the local client. | 78 // stored on the local client. |
| 79 // |login_form_signature| may be empty. It is non-empty when the user fills | 79 // |login_form_signature| may be empty. It is non-empty when the user fills |
| 80 // and submits a login form using a generated password. In this case, | 80 // and submits a login form using a generated password. In this case, |
| 81 // |login_form_signature| should be set to the submitted form's signature. | 81 // |login_form_signature| should be set to the submitted form's signature. |
| 82 // Note that in this case, |form.FormSignature()| gives the signature for the | 82 // Note that in this case, |form.FormSignature()| gives the signature for the |
| 83 // registration form on which the password was generated, rather than the | 83 // registration form on which the password was generated, rather than the |
| 84 // submitted form's signature. | 84 // submitted form's signature. |
| 85 bool StartUploadRequest(const FormStructure& form, | 85 virtual bool StartUploadRequest(const FormStructure& form, |
| 86 bool form_was_autofilled, | 86 bool form_was_autofilled, |
| 87 const ServerFieldTypeSet& available_field_types, | 87 const ServerFieldTypeSet& available_field_types, |
| 88 const std::string& login_form_signature); | 88 const std::string& login_form_signature); |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 friend class AutofillDownloadTest; | 91 friend class AutofillDownloadTest; |
| 92 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest); | 92 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest); |
| 93 | 93 |
| 94 struct FormRequestData; | 94 struct FormRequestData; |
| 95 typedef std::list<std::pair<std::string, std::string> > QueryRequestCache; | 95 typedef std::list<std::pair<std::string, std::string> > QueryRequestCache; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 double positive_upload_rate_; | 165 double positive_upload_rate_; |
| 166 double negative_upload_rate_; | 166 double negative_upload_rate_; |
| 167 | 167 |
| 168 // Needed for unit-test. | 168 // Needed for unit-test. |
| 169 int fetcher_id_for_unittest_; | 169 int fetcher_id_for_unittest_; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace autofill | 172 } // namespace autofill |
| 173 | 173 |
| 174 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 174 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |