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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // called multiple times during the life of the DatabaseManager. Should be | 198 // called multiple times during the life of the DatabaseManager. Should be |
199 // called on IO thread. | 199 // called on IO thread. |
200 void StartOnIOThread(); | 200 void StartOnIOThread(); |
201 | 201 |
202 // Called to stop or shutdown operations on the io_thread. This may be called | 202 // Called to stop or shutdown operations on the io_thread. This may be called |
203 // multiple times during the life of the DatabaseManager. Should be called | 203 // multiple times during the life of the DatabaseManager. Should be called |
204 // on IO thread. If shutdown is true, the manager is disabled permanently. | 204 // on IO thread. If shutdown is true, the manager is disabled permanently. |
205 void StopOnIOThread(bool shutdown); | 205 void StopOnIOThread(bool shutdown); |
206 | 206 |
207 protected: | 207 protected: |
208 virtual ~SafeBrowsingDatabaseManager(); | 208 ~SafeBrowsingDatabaseManager() override; |
209 | 209 |
210 // protected for tests. | 210 // protected for tests. |
211 void NotifyDatabaseUpdateFinished(bool update_succeeded); | 211 void NotifyDatabaseUpdateFinished(bool update_succeeded); |
212 | 212 |
213 private: | 213 private: |
214 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 214 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
215 friend class SafeBrowsingServerTest; | 215 friend class SafeBrowsingServerTest; |
216 friend class SafeBrowsingServiceTest; | 216 friend class SafeBrowsingServiceTest; |
217 friend class SafeBrowsingServiceTestHelper; | 217 friend class SafeBrowsingServiceTestHelper; |
218 friend class SafeBrowsingDatabaseManagerTest; | 218 friend class SafeBrowsingDatabaseManagerTest; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // Helper function that calls safe browsing client and cleans up |checks_|. | 334 // Helper function that calls safe browsing client and cleans up |checks_|. |
335 void SafeBrowsingCheckDone(SafeBrowsingCheck* check); | 335 void SafeBrowsingCheckDone(SafeBrowsingCheck* check); |
336 | 336 |
337 // Helper function to set |check| with default values and start a safe | 337 // Helper function to set |check| with default values and start a safe |
338 // browsing check with timeout of |timeout|. |task| will be called on | 338 // browsing check with timeout of |timeout|. |task| will be called on |
339 // success, otherwise TimeoutCallback will be called. | 339 // success, otherwise TimeoutCallback will be called. |
340 void StartSafeBrowsingCheck(SafeBrowsingCheck* check, | 340 void StartSafeBrowsingCheck(SafeBrowsingCheck* check, |
341 const base::Closure& task); | 341 const base::Closure& task); |
342 | 342 |
343 // SafeBrowsingProtocolManageDelegate override | 343 // SafeBrowsingProtocolManageDelegate override |
344 virtual void ResetDatabase() override; | 344 void ResetDatabase() override; |
345 virtual void UpdateStarted() override; | 345 void UpdateStarted() override; |
346 virtual void UpdateFinished(bool success) override; | 346 void UpdateFinished(bool success) override; |
347 virtual void GetChunks(GetChunksCallback callback) override; | 347 void GetChunks(GetChunksCallback callback) override; |
348 virtual void AddChunks(const std::string& list, | 348 void AddChunks(const std::string& list, |
349 scoped_ptr<ScopedVector<SBChunkData> > chunks, | 349 scoped_ptr<ScopedVector<SBChunkData>> chunks, |
350 AddChunksCallback callback) override; | 350 AddChunksCallback callback) override; |
351 virtual void DeleteChunks( | 351 void DeleteChunks( |
352 scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) override; | 352 scoped_ptr<std::vector<SBChunkDelete>> chunk_deletes) override; |
353 | 353 |
354 scoped_refptr<SafeBrowsingService> sb_service_; | 354 scoped_refptr<SafeBrowsingService> sb_service_; |
355 | 355 |
356 CurrentChecks checks_; | 356 CurrentChecks checks_; |
357 | 357 |
358 // Used for issuing only one GetHash request for a given prefix. | 358 // Used for issuing only one GetHash request for a given prefix. |
359 GetHashRequests gethash_requests_; | 359 GetHashRequests gethash_requests_; |
360 | 360 |
361 // The persistent database. We don't use a scoped_ptr because it | 361 // The persistent database. We don't use a scoped_ptr because it |
362 // needs to be destroyed on a different thread than this object. | 362 // needs to be destroyed on a different thread than this object. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 std::deque<QueuedCheck> queued_checks_; | 410 std::deque<QueuedCheck> queued_checks_; |
411 | 411 |
412 // Timeout to use for safe browsing checks. | 412 // Timeout to use for safe browsing checks. |
413 base::TimeDelta check_timeout_; | 413 base::TimeDelta check_timeout_; |
414 | 414 |
415 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); | 415 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); |
416 }; | 416 }; |
417 | 417 |
418 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 418 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
OLD | NEW |