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( |
86 bool form_was_autofilled, | 86 const FormStructure& form, |
87 const ServerFieldTypeSet& available_field_types, | 87 bool form_was_autofilled, |
88 const std::string& login_form_signature); | 88 const ServerFieldTypeSet& available_field_types, |
| 89 const std::string& login_form_signature); |
89 | 90 |
90 private: | 91 private: |
91 friend class AutofillDownloadTest; | 92 friend class AutofillDownloadTest; |
92 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest); | 93 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest); |
93 | 94 |
94 struct FormRequestData; | 95 struct FormRequestData; |
95 typedef std::list<std::pair<std::string, std::string> > QueryRequestCache; | 96 typedef std::list<std::pair<std::string, std::string> > QueryRequestCache; |
96 | 97 |
97 // Initiates request to Autofill servers to download/upload heuristics. | 98 // Initiates request to Autofill servers to download/upload heuristics. |
98 // |form_xml| - form structure XML to upload/download. | 99 // |form_xml| - form structure XML to upload/download. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 double positive_upload_rate_; | 166 double positive_upload_rate_; |
166 double negative_upload_rate_; | 167 double negative_upload_rate_; |
167 | 168 |
168 // Needed for unit-test. | 169 // Needed for unit-test. |
169 int fetcher_id_for_unittest_; | 170 int fetcher_id_for_unittest_; |
170 }; | 171 }; |
171 | 172 |
172 } // namespace autofill | 173 } // namespace autofill |
173 | 174 |
174 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 175 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
OLD | NEW |