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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // for each list is done. If database_error is true, that means the protocol | 67 // for each list is done. If database_error is true, that means the protocol |
68 // manager shouldn't fetch updates since they can't be written to disk. It | 68 // manager shouldn't fetch updates since they can't be written to disk. It |
69 // should try again later to open the database. | 69 // should try again later to open the database. |
70 void OnGetChunksComplete(const std::vector<SBListChunkRanges>& list, | 70 void OnGetChunksComplete(const std::vector<SBListChunkRanges>& list, |
71 bool database_error); | 71 bool database_error); |
72 | 72 |
73 // Called after the chunks that were parsed were inserted in the database. | 73 // Called after the chunks that were parsed were inserted in the database. |
74 void OnChunkInserted(); | 74 void OnChunkInserted(); |
75 | 75 |
76 // The last time we received an update. | 76 // The last time we received an update. |
77 Time last_update() const { return last_update_; } | 77 base::Time last_update() const { return last_update_; } |
78 | 78 |
79 private: | 79 private: |
80 // Internal API for fetching information from the SafeBrowsing servers. The | 80 // Internal API for fetching information from the SafeBrowsing servers. The |
81 // GetHash requests are higher priority since they can block user requests | 81 // GetHash requests are higher priority since they can block user requests |
82 // so are handled separately. | 82 // so are handled separately. |
83 enum SafeBrowsingRequestType { | 83 enum SafeBrowsingRequestType { |
84 NO_REQUEST = 0, // No requests in progress | 84 NO_REQUEST = 0, // No requests in progress |
85 UPDATE_REQUEST, // Request for redirect URLs | 85 UPDATE_REQUEST, // Request for redirect URLs |
86 CHUNK_REQUEST, // Request for a specific chunk | 86 CHUNK_REQUEST, // Request for a specific chunk |
87 GETKEY_REQUEST // Update the client's MAC key | 87 GETKEY_REQUEST // Update the client's MAC key |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 // Message loop for forwarding MAC keys to the SafeBrowsingService for | 190 // Message loop for forwarding MAC keys to the SafeBrowsingService for |
191 // storage. | 191 // storage. |
192 MessageLoop* notify_loop_; | 192 MessageLoop* notify_loop_; |
193 | 193 |
194 // The keys used for MAC. Empty keys mean we aren't using MAC. | 194 // The keys used for MAC. Empty keys mean we aren't using MAC. |
195 std::string client_key_; | 195 std::string client_key_; |
196 std::string wrapped_key_; | 196 std::string wrapped_key_; |
197 | 197 |
198 // The last time we successfully received an update. | 198 // The last time we successfully received an update. |
199 Time last_update_; | 199 base::Time last_update_; |
200 | 200 |
201 // While in GetHash backoff, we can't make another GetHash until this time. | 201 // While in GetHash backoff, we can't make another GetHash until this time. |
202 Time next_gethash_time_; | 202 base::Time next_gethash_time_; |
203 | 203 |
204 // Current product version sent in each request. | 204 // Current product version sent in each request. |
205 std::string version_; | 205 std::string version_; |
206 | 206 |
207 DISALLOW_EVIL_CONSTRUCTORS(SafeBrowsingProtocolManager); | 207 DISALLOW_EVIL_CONSTRUCTORS(SafeBrowsingProtocolManager); |
208 }; | 208 }; |
209 | 209 |
210 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 210 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
OLD | NEW |