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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // GetNegativeUploadRate() for non matched. | 85 // GetNegativeUploadRate() for non matched. |
86 double GetPositiveUploadRate() const; | 86 double GetPositiveUploadRate() const; |
87 double GetNegativeUploadRate() const; | 87 double GetNegativeUploadRate() const; |
88 // These functions called very rarely outside of theunit-tests. With current | 88 // These functions called very rarely outside of theunit-tests. With current |
89 // percentages, they would be called once per 100 auto-fillable forms filled | 89 // percentages, they would be called once per 100 auto-fillable forms filled |
90 // and submitted by user. The order of magnitude would remain similar in the | 90 // and submitted by user. The order of magnitude would remain similar in the |
91 // future. | 91 // future. |
92 void SetPositiveUploadRate(double rate); | 92 void SetPositiveUploadRate(double rate); |
93 void SetNegativeUploadRate(double rate); | 93 void SetNegativeUploadRate(double rate); |
94 | 94 |
95 // Clears and re-initializes the |presence_bitfield_| with 0s. | |
96 void ClearPresence(); | |
97 // Set |field_type| presence bit in the |presence_bitfield_|. | |
98 void SetPresenceBit(AutoFillFieldType field_type); | |
99 // Converts |presence_bitfield_| to string for uploading. | |
100 std::string ConvertPresenceBitsToString(); | |
101 | |
95 private: | 102 private: |
96 friend class AutoFillDownloadTestHelper; // unit-test. | 103 friend class AutoFillDownloadTestHelper; // unit-test. |
97 | 104 |
98 struct FormRequestData; | 105 struct FormRequestData; |
99 | 106 |
100 // Initiates request to AutoFill servers to download/upload heuristics. | 107 // Initiates request to AutoFill servers to download/upload heuristics. |
101 // |form_xml| - form structure XML to upload/download. | 108 // |form_xml| - form structure XML to upload/download. |
102 // |request_data| - form signature hash(es) and indicator if it was a query. | 109 // |request_data| - form signature hash(es) and indicator if it was a query. |
103 // |request_data.query| - if true the data is queried and observer notified | 110 // |request_data.query| - if true the data is queried and observer notified |
104 // with new data, if available. If false heuristic data is uploaded to our | 111 // with new data, if available. If false heuristic data is uploaded to our |
(...skipping 11 matching lines...) Expand all Loading... | |
116 | 123 |
117 // Profile for preference storage. | 124 // Profile for preference storage. |
118 Profile* profile_; | 125 Profile* profile_; |
119 | 126 |
120 // For each requested form for both query and upload we create a separate | 127 // For each requested form for both query and upload we create a separate |
121 // request and save its info. As url fetcher is identified by its address | 128 // request and save its info. As url fetcher is identified by its address |
122 // we use a map between fetchers and info. | 129 // we use a map between fetchers and info. |
123 std::map<URLFetcher*, FormRequestData> url_fetchers_; | 130 std::map<URLFetcher*, FormRequestData> url_fetchers_; |
124 AutoFillDownloadManager::Observer *observer_; | 131 AutoFillDownloadManager::Observer *observer_; |
125 | 132 |
133 std::vector<uint8> presence_bitfield_; | |
dhollowa
2011/01/18 22:11:40
I'm wondering why we need to store this. The |for
| |
134 | |
126 // Time when next query/upload requests are allowed. If 50x HTTP received, | 135 // Time when next query/upload requests are allowed. If 50x HTTP received, |
127 // exponential back off is initiated, so this times will be in the future | 136 // exponential back off is initiated, so this times will be in the future |
128 // for awhile. | 137 // for awhile. |
129 base::Time next_query_request_; | 138 base::Time next_query_request_; |
130 base::Time next_upload_request_; | 139 base::Time next_upload_request_; |
131 | 140 |
132 // |positive_upload_rate_| is for matched forms, | 141 // |positive_upload_rate_| is for matched forms, |
133 // |negative_upload_rate_| for non matched. | 142 // |negative_upload_rate_| for non matched. |
134 double positive_upload_rate_; | 143 double positive_upload_rate_; |
135 double negative_upload_rate_; | 144 double negative_upload_rate_; |
136 | 145 |
137 // Needed for unit-test. | 146 // Needed for unit-test. |
138 int fetcher_id_for_unittest_; | 147 int fetcher_id_for_unittest_; |
139 bool is_testing_; | 148 bool is_testing_; |
140 }; | 149 }; |
141 | 150 |
142 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ | 151 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ |
143 | 152 |
OLD | NEW |