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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Called on the database thread to retrieve chunks. | 227 // Called on the database thread to retrieve chunks. |
228 void GetAllChunksFromDatabase(GetChunksCallback callback); | 228 void GetAllChunksFromDatabase(GetChunksCallback callback); |
229 | 229 |
230 // Called on the IO thread with the results of all chunks. | 230 // Called on the IO thread with the results of all chunks. |
231 void OnGetAllChunksFromDatabase(const std::vector<SBListChunkRanges>& lists, | 231 void OnGetAllChunksFromDatabase(const std::vector<SBListChunkRanges>& lists, |
232 bool database_error, | 232 bool database_error, |
233 GetChunksCallback callback); | 233 GetChunksCallback callback); |
234 | 234 |
235 // Called on the IO thread after the database reports that it added a chunk. | 235 // Called on the IO thread after the database reports that it added a chunk. |
236 void OnChunkInserted(); | 236 void OnAddChunksComplete(AddChunksCallback callback); |
237 | 237 |
238 // Notification that the database is done loading its bloom filter. We may | 238 // Notification that the database is done loading its bloom filter. We may |
239 // have had to queue checks until the database is ready, and if so, this | 239 // have had to queue checks until the database is ready, and if so, this |
240 // checks them. | 240 // checks them. |
241 void DatabaseLoadComplete(); | 241 void DatabaseLoadComplete(); |
242 | 242 |
243 // Called on the database thread to add/remove chunks and host keys. | 243 // Called on the database thread to add/remove chunks and host keys. |
244 // Callee will free the data when it's done. | 244 // Callee will free the data when it's done. |
245 void HandleChunkForDatabase(const std::string& list, | 245 void AddDatabaseChunks(const std::string& list, SBChunkList* chunks, |
246 SBChunkList* chunks); | 246 AddChunksCallback callback); |
247 | 247 |
248 void DeleteDatabaseChunks(std::vector<SBChunkDelete>* chunk_deletes); | 248 void DeleteDatabaseChunks(std::vector<SBChunkDelete>* chunk_deletes); |
249 | 249 |
250 static SBThreatType GetThreatTypeFromListname(const std::string& list_name); | 250 static SBThreatType GetThreatTypeFromListname(const std::string& list_name); |
251 | 251 |
252 void NotifyClientBlockingComplete(Client* client, bool proceed); | 252 void NotifyClientBlockingComplete(Client* client, bool proceed); |
253 | 253 |
254 void DatabaseUpdateFinished(bool update_succeeded); | 254 void DatabaseUpdateFinished(bool update_succeeded); |
255 | 255 |
256 void NotifyDatabaseUpdateFinished(bool update_succeeded); | 256 void NotifyDatabaseUpdateFinished(bool update_succeeded); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void StartDownloadCheck(SafeBrowsingCheck* check, | 301 void StartDownloadCheck(SafeBrowsingCheck* check, |
302 Client* client, | 302 Client* client, |
303 const base::Closure& task, | 303 const base::Closure& task, |
304 int64 timeout_ms); | 304 int64 timeout_ms); |
305 | 305 |
306 // SafeBrowsingProtocolManageDelegate override | 306 // SafeBrowsingProtocolManageDelegate override |
307 virtual void ResetDatabase() OVERRIDE; | 307 virtual void ResetDatabase() OVERRIDE; |
308 virtual void UpdateStarted() OVERRIDE; | 308 virtual void UpdateStarted() OVERRIDE; |
309 virtual void UpdateFinished(bool success) OVERRIDE; | 309 virtual void UpdateFinished(bool success) OVERRIDE; |
310 virtual void GetChunks(GetChunksCallback callback) OVERRIDE; | 310 virtual void GetChunks(GetChunksCallback callback) OVERRIDE; |
311 virtual void AddChunks(const std::string& list, SBChunkList* chunks) OVERRIDE; | 311 virtual void AddChunks(const std::string& list, SBChunkList* chunks, |
| 312 AddChunksCallback callback) OVERRIDE; |
312 virtual void DeleteChunks( | 313 virtual void DeleteChunks( |
313 std::vector<SBChunkDelete>* delete_chunks) OVERRIDE; | 314 std::vector<SBChunkDelete>* delete_chunks) OVERRIDE; |
314 | 315 |
315 scoped_refptr<SafeBrowsingService> sb_service_; | 316 scoped_refptr<SafeBrowsingService> sb_service_; |
316 | 317 |
317 CurrentChecks checks_; | 318 CurrentChecks checks_; |
318 | 319 |
319 // Used for issuing only one GetHash request for a given prefix. | 320 // Used for issuing only one GetHash request for a given prefix. |
320 GetHashRequests gethash_requests_; | 321 GetHashRequests gethash_requests_; |
321 | 322 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // without waiting for the result. | 366 // without waiting for the result. |
366 int64 download_urlcheck_timeout_ms_; | 367 int64 download_urlcheck_timeout_ms_; |
367 | 368 |
368 // Similar to |download_urlcheck_timeout_ms_|, but for download hash checks. | 369 // Similar to |download_urlcheck_timeout_ms_|, but for download hash checks. |
369 int64 download_hashcheck_timeout_ms_; | 370 int64 download_hashcheck_timeout_ms_; |
370 | 371 |
371 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); | 372 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); |
372 }; | 373 }; |
373 | 374 |
374 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 375 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
OLD | NEW |