| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The SafeBrowsingProtocolManager handles formatting and making requests of, | 9 // The SafeBrowsingProtocolManager handles formatting and making requests of, |
| 10 // and handling responses from, Google's SafeBrowsing servers. This class uses | 10 // and handling responses from, Google's SafeBrowsing servers. This class uses |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 class SafeBrowsingProtocolManager : public URLFetcher::Delegate { | 44 class SafeBrowsingProtocolManager : public URLFetcher::Delegate { |
| 45 // Testing friends: | 45 // Testing friends: |
| 46 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestBackOffTimes); | 46 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestBackOffTimes); |
| 47 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestChunkStrings); | 47 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestChunkStrings); |
| 48 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestGetHashBackOffTimes); | 48 FRIEND_TEST(SafeBrowsingProtocolManagerTest, TestGetHashBackOffTimes); |
| 49 | 49 |
| 50 public: | 50 public: |
| 51 // Constructs a SafeBrowsingProtocolManager for |sb_service| that issues |
| 52 // network requests using |request_context_getter|. |
| 51 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, | 53 SafeBrowsingProtocolManager(SafeBrowsingService* sb_service, |
| 52 const std::string& client_name, | 54 const std::string& client_name, |
| 53 const std::string& client_key, | 55 const std::string& client_key, |
| 54 const std::string& wrapped_key); | 56 const std::string& wrapped_key, |
| 57 URLRequestContextGetter* request_context_getter); |
| 55 ~SafeBrowsingProtocolManager(); | 58 ~SafeBrowsingProtocolManager(); |
| 56 | 59 |
| 57 // Set up the update schedule and internal state for making periodic requests | 60 // Set up the update schedule and internal state for making periodic requests |
| 58 // of the SafeBrowsing service. | 61 // of the SafeBrowsing service. |
| 59 void Initialize(); | 62 void Initialize(); |
| 60 | 63 |
| 61 // URLFetcher::Delegate interface. | 64 // URLFetcher::Delegate interface. |
| 62 virtual void OnURLFetchComplete(const URLFetcher* source, | 65 virtual void OnURLFetchComplete(const URLFetcher* source, |
| 63 const GURL& url, | 66 const GURL& url, |
| 64 const URLRequestStatus& status, | 67 const URLRequestStatus& status, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 232 |
| 230 // Track the size of each update (in bytes). | 233 // Track the size of each update (in bytes). |
| 231 int update_size_; | 234 int update_size_; |
| 232 | 235 |
| 233 // Track outstanding malware report fetchers for clean up. | 236 // Track outstanding malware report fetchers for clean up. |
| 234 std::set<const URLFetcher*> malware_reports_; | 237 std::set<const URLFetcher*> malware_reports_; |
| 235 | 238 |
| 236 // The safe browsing client name sent in each request. | 239 // The safe browsing client name sent in each request. |
| 237 std::string client_name_; | 240 std::string client_name_; |
| 238 | 241 |
| 242 // The context we use to issue network requests. |
| 243 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
| 244 |
| 239 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); | 245 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingProtocolManager); |
| 240 }; | 246 }; |
| 241 | 247 |
| 242 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 248 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
| OLD | NEW |