| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_SAFE_BROWSING_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/hash_tables.h" | 16 #include "base/hash_tables.h" |
| 17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
| 19 #include "base/thread.h" | 19 #include "base/thread.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 21 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 23 #include "webkit/glue/resource_type.h" | 23 #include "webkit/glue/resource_type.h" |
| 24 | 24 |
| 25 class BloomFilter; | 25 class BloomFilter; |
| 26 class PrefService; | 26 class PrefService; |
| 27 class SafeBrowsingBlockingPage; | 27 class SafeBrowsingBlockingPage; |
| 28 class SafeBrowsingDatabase; | 28 class SafeBrowsingDatabase; |
| 29 class SafeBrowsingProtocolManager; | 29 class SafeBrowsingProtocolManager; |
| 30 class URLRequestContextGetter; |
| 30 | 31 |
| 31 // Construction needs to happen on the main thread. | 32 // Construction needs to happen on the main thread. |
| 32 class SafeBrowsingService | 33 class SafeBrowsingService |
| 33 : public base::RefCountedThreadSafe<SafeBrowsingService> { | 34 : public base::RefCountedThreadSafe<SafeBrowsingService> { |
| 34 public: | 35 public: |
| 35 // Users of this service implement this interface to be notified | 36 // Users of this service implement this interface to be notified |
| 36 // asynchronously of the result. | 37 // asynchronously of the result. |
| 37 enum UrlCheckResult { | 38 enum UrlCheckResult { |
| 38 URL_SAFE, | 39 URL_SAFE, |
| 39 URL_PHISHING, | 40 URL_PHISHING, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 // Creates the safe browsing service. Need to initialize before using. | 67 // Creates the safe browsing service. Need to initialize before using. |
| 67 SafeBrowsingService(); | 68 SafeBrowsingService(); |
| 68 | 69 |
| 69 // Initializes the service. | 70 // Initializes the service. |
| 70 void Initialize(); | 71 void Initialize(); |
| 71 | 72 |
| 72 // Called to initialize objects that are used on the io_thread. | 73 // Called to initialize objects that are used on the io_thread. |
| 73 void OnIOInitialize(const std::string& client_key, | 74 void OnIOInitialize(const std::string& client_key, |
| 74 const std::string& wrapped_key); | 75 const std::string& wrapped_key, |
| 76 URLRequestContextGetter* request_context_getter); |
| 75 | 77 |
| 76 // Called to initialize objects that are used on the db_thread. | 78 // Called to initialize objects that are used on the db_thread. |
| 77 void OnDBInitialize(); | 79 void OnDBInitialize(); |
| 78 | 80 |
| 79 // Called to shutdown operations on the io_thread. | 81 // Called to shutdown operations on the io_thread. |
| 80 void OnIOShutdown(); | 82 void OnIOShutdown(); |
| 81 | 83 |
| 82 // Called on the main thread to let us know that the io_thread is going away. | 84 // Called on the main thread to let us know that the io_thread is going away. |
| 83 void ShutDown(); | 85 void ShutDown(); |
| 84 | 86 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 Client* client; | 280 Client* client; |
| 279 GURL url; | 281 GURL url; |
| 280 base::Time start; | 282 base::Time start; |
| 281 } QueuedCheck; | 283 } QueuedCheck; |
| 282 std::deque<QueuedCheck> queued_checks_; | 284 std::deque<QueuedCheck> queued_checks_; |
| 283 | 285 |
| 284 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); | 286 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
| 285 }; | 287 }; |
| 286 | 288 |
| 287 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 289 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |