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_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // A class that implements Chrome's interface with the SafeBrowsing protocol. | 9 // A class that implements Chrome's interface with the SafeBrowsing protocol. |
10 // The SafeBrowsingProtocolManager handles formatting and making requests of, | 10 // The SafeBrowsingProtocolManager handles formatting and making requests of, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // be changed in the middle of an update, caller (e.g.: SafeBrowsingService) | 151 // be changed in the middle of an update, caller (e.g.: SafeBrowsingService) |
152 // should call this after callbacks triggered in UpdateFinished() or before | 152 // should call this after callbacks triggered in UpdateFinished() or before |
153 // IssueUpdateRequest(). | 153 // IssueUpdateRequest(). |
154 void set_additional_query(const std::string& query) { | 154 void set_additional_query(const std::string& query) { |
155 additional_query_ = query; | 155 additional_query_ = query; |
156 } | 156 } |
157 const std::string& additional_query() const { | 157 const std::string& additional_query() const { |
158 return additional_query_; | 158 return additional_query_; |
159 } | 159 } |
160 | 160 |
161 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE | |
162 // ORDERING OF THESE VALUES. | |
163 enum ResultType { | |
164 // A 204 response code means that the server did not know about | |
165 // the hash prefix that was sent up. | |
166 GET_HASH_STATUS_200, | |
167 GET_HASH_STATUS_204, | |
168 | |
169 // Responses which returned no full hashes. This includes the 204 | |
170 // case, and also 200 responses for prefixes which are logically | |
Erik does not do reviews
2010/12/22 22:07:22
So should we split these up? GET_HASH_FULL_HASH_E
Scott Hess - ex-Googler
2010/12/22 22:13:20
My understanding is that every GET_HASH_STATUS_204
lzheng
2010/12/22 23:56:51
That's my understanding too. So, GET_HASH_FULL_HAS
| |
171 // deleted at the server but not yet updated to the client. | |
172 GET_HASH_FULL_HASH_EMPTY, | |
173 | |
174 // Subset of 200 responses for which one or more of the full | |
175 // hashes matched. | |
176 GET_HASH_FULL_HASH_HIT, | |
177 | |
178 // Memory space for histograms is determined by the max. ALWAYS | |
179 // ADD NEW VALUES BEFORE THIS ONE. | |
180 GET_HASH_RESULT_MAX | |
181 }; | |
182 | |
183 // Record a GetHash result. | |
184 static void RecordGetHashResult(ResultType result_type); | |
185 | |
161 protected: | 186 protected: |
162 // Constructs a SafeBrowsingProtocolManager for |sb_service| that issues | 187 // Constructs a SafeBrowsingProtocolManager for |sb_service| that issues |
163 // network requests using |request_context_getter|. When |disable_auto_update| | 188 // network requests using |request_context_getter|. When |disable_auto_update| |
164 // is true, protocol manager won't schedule next update until | 189 // is true, protocol manager won't schedule next update until |
165 // ForceScheduleNextUpdate is called. | 190 // ForceScheduleNextUpdate is called. |
166 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, | 191 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, |
167 const std::string& client_name, | 192 const std::string& client_name, |
168 const std::string& client_key, | 193 const std::string& client_key, |
169 const std::string& wrapped_key, | 194 const std::string& wrapped_key, |
170 URLRequestContextGetter* request_context_getter, | 195 URLRequestContextGetter* request_context_getter, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 std::string https_url_prefix_; | 395 std::string https_url_prefix_; |
371 | 396 |
372 // When true, protocol manager will not start an update unless | 397 // When true, protocol manager will not start an update unless |
373 // ForceScheduleNextUpdate() is called. This is set for testing purpose. | 398 // ForceScheduleNextUpdate() is called. This is set for testing purpose. |
374 bool disable_auto_update_; | 399 bool disable_auto_update_; |
375 | 400 |
376 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); | 401 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); |
377 }; | 402 }; |
378 | 403 |
379 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 404 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
OLD | NEW |