| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 // A class that implements Chrome's interface with the SafeBrowsing protocol. | 8 // A class that implements Chrome's interface with the SafeBrowsing protocol. |
| 9 // See https://developers.google.com/safe-browsing/developers_guide_v2 for | 9 // See https://developers.google.com/safe-browsing/developers_guide_v2 for |
| 10 // protocol details. | 10 // protocol details. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // |metric_name| is the name of the UMA metric to record the response code or | 167 // |metric_name| is the name of the UMA metric to record the response code or |
| 168 // error code against, |status| represents the status of the HTTP request, and | 168 // error code against, |status| represents the status of the HTTP request, and |
| 169 // |response code| represents the HTTP response code received from the server. | 169 // |response code| represents the HTTP response code received from the server. |
| 170 static void RecordHttpResponseOrErrorCode( | 170 static void RecordHttpResponseOrErrorCode( |
| 171 const char* metric_name, const net::URLRequestStatus& status, | 171 const char* metric_name, const net::URLRequestStatus& status, |
| 172 int response_code); | 172 int response_code); |
| 173 | 173 |
| 174 // Returns whether another update is currently scheduled. | 174 // Returns whether another update is currently scheduled. |
| 175 bool IsUpdateScheduled() const; | 175 bool IsUpdateScheduled() const; |
| 176 | 176 |
| 177 static base::TimeDelta GetUpdateTimeoutForTesting(); |
| 178 |
| 177 protected: | 179 protected: |
| 178 // Constructs a SafeBrowsingProtocolManager for |delegate| that issues | 180 // Constructs a SafeBrowsingProtocolManager for |delegate| that issues |
| 179 // network requests using |request_context_getter|. | 181 // network requests using |request_context_getter|. |
| 180 SafeBrowsingProtocolManager( | 182 SafeBrowsingProtocolManager( |
| 181 SafeBrowsingProtocolManagerDelegate* delegate, | 183 SafeBrowsingProtocolManagerDelegate* delegate, |
| 182 net::URLRequestContextGetter* request_context_getter, | 184 net::URLRequestContextGetter* request_context_getter, |
| 183 const SafeBrowsingProtocolConfig& config); | 185 const SafeBrowsingProtocolConfig& config); |
| 184 | 186 |
| 185 private: | 187 private: |
| 186 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestBackOffTimes); | 188 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestBackOffTimes); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void UpdateFinished(bool success); | 275 void UpdateFinished(bool success); |
| 274 void UpdateFinished(bool success, bool back_off); | 276 void UpdateFinished(bool success, bool back_off); |
| 275 | 277 |
| 276 // A callback that runs if we timeout waiting for a response to an update | 278 // A callback that runs if we timeout waiting for a response to an update |
| 277 // request. We use this to properly set our update state. | 279 // request. We use this to properly set our update state. |
| 278 void UpdateResponseTimeout(); | 280 void UpdateResponseTimeout(); |
| 279 | 281 |
| 280 // Called after the chunks are added to the database. | 282 // Called after the chunks are added to the database. |
| 281 void OnAddChunksComplete(); | 283 void OnAddChunksComplete(); |
| 282 | 284 |
| 283 private: | |
| 284 // Map of GetHash requests to parameters which created it. | 285 // Map of GetHash requests to parameters which created it. |
| 285 struct FullHashDetails { | 286 struct FullHashDetails { |
| 286 FullHashDetails(); | 287 FullHashDetails(); |
| 287 FullHashDetails(FullHashCallback callback, bool is_download); | 288 FullHashDetails(FullHashCallback callback, bool is_download); |
| 288 FullHashDetails(const FullHashDetails& other); | 289 FullHashDetails(const FullHashDetails& other); |
| 289 ~FullHashDetails(); | 290 ~FullHashDetails(); |
| 290 | 291 |
| 291 FullHashCallback callback; | 292 FullHashCallback callback; |
| 292 bool is_download; | 293 bool is_download; |
| 293 }; | 294 }; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 AddChunksCallback callback) = 0; | 441 AddChunksCallback callback) = 0; |
| 441 | 442 |
| 442 // Delete chunks from the database. | 443 // Delete chunks from the database. |
| 443 virtual void DeleteChunks( | 444 virtual void DeleteChunks( |
| 444 std::unique_ptr<std::vector<SBChunkDelete>> chunk_deletes) = 0; | 445 std::unique_ptr<std::vector<SBChunkDelete>> chunk_deletes) = 0; |
| 445 }; | 446 }; |
| 446 | 447 |
| 447 } // namespace safe_browsing | 448 } // namespace safe_browsing |
| 448 | 449 |
| 449 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 450 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
| OLD | NEW |