| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 void StartOnIOThread(); | 203 void StartOnIOThread(); |
| 204 | 204 |
| 205 // Called to stop or shutdown operations on the io_thread. This may be called | 205 // Called to stop or shutdown operations on the io_thread. This may be called |
| 206 // multiple times during the life of the DatabaseManager. Should be called | 206 // multiple times during the life of the DatabaseManager. Should be called |
| 207 // on IO thread. If shutdown is true, the manager is disabled permanently. | 207 // on IO thread. If shutdown is true, the manager is disabled permanently. |
| 208 void StopOnIOThread(bool shutdown); | 208 void StopOnIOThread(bool shutdown); |
| 209 | 209 |
| 210 protected: | 210 protected: |
| 211 virtual ~SafeBrowsingDatabaseManager(); | 211 virtual ~SafeBrowsingDatabaseManager(); |
| 212 | 212 |
| 213 // protected for tests. |
| 214 void NotifyDatabaseUpdateFinished(bool update_succeeded); |
| 215 |
| 213 private: | 216 private: |
| 214 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 217 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
| 215 friend class SafeBrowsingServerTest; | 218 friend class SafeBrowsingServerTest; |
| 216 friend class SafeBrowsingServiceTest; | 219 friend class SafeBrowsingServiceTest; |
| 217 friend class SafeBrowsingServiceTestHelper; | 220 friend class SafeBrowsingServiceTestHelper; |
| 218 friend class SafeBrowsingDatabaseManagerTest; | 221 friend class SafeBrowsingDatabaseManagerTest; |
| 219 | 222 |
| 220 typedef std::set<SafeBrowsingCheck*> CurrentChecks; | 223 typedef std::set<SafeBrowsingCheck*> CurrentChecks; |
| 221 typedef std::vector<SafeBrowsingCheck*> GetHashRequestors; | 224 typedef std::vector<SafeBrowsingCheck*> GetHashRequestors; |
| 222 typedef base::hash_map<SBPrefix, GetHashRequestors> GetHashRequests; | 225 typedef base::hash_map<SBPrefix, GetHashRequestors> GetHashRequests; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 AddChunksCallback callback); | 291 AddChunksCallback callback); |
| 289 | 292 |
| 290 void DeleteDatabaseChunks(std::vector<SBChunkDelete>* chunk_deletes); | 293 void DeleteDatabaseChunks(std::vector<SBChunkDelete>* chunk_deletes); |
| 291 | 294 |
| 292 static SBThreatType GetThreatTypeFromListname(const std::string& list_name); | 295 static SBThreatType GetThreatTypeFromListname(const std::string& list_name); |
| 293 | 296 |
| 294 void NotifyClientBlockingComplete(Client* client, bool proceed); | 297 void NotifyClientBlockingComplete(Client* client, bool proceed); |
| 295 | 298 |
| 296 void DatabaseUpdateFinished(bool update_succeeded); | 299 void DatabaseUpdateFinished(bool update_succeeded); |
| 297 | 300 |
| 298 void NotifyDatabaseUpdateFinished(bool update_succeeded); | |
| 299 | |
| 300 // Called on the db thread to close the database. See CloseDatabase(). | 301 // Called on the db thread to close the database. See CloseDatabase(). |
| 301 void OnCloseDatabase(); | 302 void OnCloseDatabase(); |
| 302 | 303 |
| 303 // Runs on the db thread to reset the database. We assume that resetting the | 304 // Runs on the db thread to reset the database. We assume that resetting the |
| 304 // database is a synchronous operation. | 305 // database is a synchronous operation. |
| 305 void OnResetDatabase(); | 306 void OnResetDatabase(); |
| 306 | 307 |
| 307 // Store in-memory the GetHash response. Runs on the database thread. | 308 // Store in-memory the GetHash response. Runs on the database thread. |
| 308 void CacheHashResults(const std::vector<SBPrefix>& prefixes, | 309 void CacheHashResults(const std::vector<SBPrefix>& prefixes, |
| 309 const std::vector<SBFullHashResult>& full_hashes); | 310 const std::vector<SBFullHashResult>& full_hashes); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 412 |
| 412 std::deque<QueuedCheck> queued_checks_; | 413 std::deque<QueuedCheck> queued_checks_; |
| 413 | 414 |
| 414 // Timeout to use for safe browsing checks. | 415 // Timeout to use for safe browsing checks. |
| 415 base::TimeDelta check_timeout_; | 416 base::TimeDelta check_timeout_; |
| 416 | 417 |
| 417 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); | 418 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); |
| 418 }; | 419 }; |
| 419 | 420 |
| 420 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 421 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
| OLD | NEW |