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 GET_HASH_STATUS_200, | |
Erik does not do reviews
2010/12/22 19:29:19
Is it worth tracking other status codes here? It
Scott Hess - ex-Googler
2010/12/22 20:41:51
Hmm. I vote for a separate histogram. It can enu
| |
165 GET_HASH_STATUS_204, | |
166 GET_HASH_NO_HITS, // None of the full hashes matched. | |
lzheng
2010/12/22 00:24:58
Can you add some more comments to clarify that GET
Scott Hess - ex-Googler
2010/12/22 20:41:51
In thinking this through, my understanding is that
Scott Hess - ex-Googler
2010/12/22 20:49:36
Glad I thought more, because GET_HASH_STATUS_200 c
| |
167 | |
168 // Memory space for histograms is determined by the max. ALWAYS | |
169 // ADD NEW VALUES BEFORE THIS ONE. | |
170 GET_HASH_RESULT_MAX | |
171 }; | |
172 | |
173 // Record a GetHash result. | |
174 static void RecordGetHashResult(ResultType result_type); | |
175 | |
161 protected: | 176 protected: |
162 // Constructs a SafeBrowsingProtocolManager for |sb_service| that issues | 177 // Constructs a SafeBrowsingProtocolManager for |sb_service| that issues |
163 // network requests using |request_context_getter|. When |disable_auto_update| | 178 // network requests using |request_context_getter|. When |disable_auto_update| |
164 // is true, protocol manager won't schedule next update until | 179 // is true, protocol manager won't schedule next update until |
165 // ForceScheduleNextUpdate is called. | 180 // ForceScheduleNextUpdate is called. |
166 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, | 181 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, |
167 const std::string& client_name, | 182 const std::string& client_name, |
168 const std::string& client_key, | 183 const std::string& client_key, |
169 const std::string& wrapped_key, | 184 const std::string& wrapped_key, |
170 URLRequestContextGetter* request_context_getter, | 185 URLRequestContextGetter* request_context_getter, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 std::string https_url_prefix_; | 385 std::string https_url_prefix_; |
371 | 386 |
372 // When true, protocol manager will not start an update unless | 387 // When true, protocol manager will not start an update unless |
373 // ForceScheduleNextUpdate() is called. This is set for testing purpose. | 388 // ForceScheduleNextUpdate() is called. This is set for testing purpose. |
374 bool disable_auto_update_; | 389 bool disable_auto_update_; |
375 | 390 |
376 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); | 391 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); |
377 }; | 392 }; |
378 | 393 |
379 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 394 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
OLD | NEW |