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 COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "components/safe_browsing_db/hit_report.h" | 18 #include "components/safe_browsing_db/hit_report.h" |
19 #include "components/safe_browsing_db/util.h" | 19 #include "components/safe_browsing_db/util.h" |
20 #include "content/public/common/resource_type.h" | 20 #include "content/public/common/resource_type.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
25 } // namespace net | 25 } // namespace net |
26 | 26 |
27 namespace safe_browsing { | 27 namespace safe_browsing { |
28 | 28 |
29 struct V4GetHashProtocolConfig; | 29 struct V4ProtocolConfig; |
30 class V4GetHashProtocolManager; | 30 class V4GetHashProtocolManager; |
31 | 31 |
32 // Base class to either the locally-managed or a remotely-managed database. | 32 // Base class to either the locally-managed or a remotely-managed database. |
33 class SafeBrowsingDatabaseManager | 33 class SafeBrowsingDatabaseManager |
34 : public base::RefCountedThreadSafe<SafeBrowsingDatabaseManager> { | 34 : public base::RefCountedThreadSafe<SafeBrowsingDatabaseManager> { |
35 public: | 35 public: |
36 // Callers requesting a result should derive from this class. | 36 // Callers requesting a result should derive from this class. |
37 // The destructor should call db_manager->CancelCheck(client) if a | 37 // The destructor should call db_manager->CancelCheck(client) if a |
38 // request is still pending. | 38 // request is still pending. |
39 class Client { | 39 class Client { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // on IO thread. If shutdown is true, the manager is disabled permanently. | 168 // on IO thread. If shutdown is true, the manager is disabled permanently. |
169 virtual void StopOnIOThread(bool shutdown) = 0; | 169 virtual void StopOnIOThread(bool shutdown) = 0; |
170 | 170 |
171 protected: | 171 protected: |
172 // Use this constructor for testing only. | 172 // Use this constructor for testing only. |
173 SafeBrowsingDatabaseManager(); | 173 SafeBrowsingDatabaseManager(); |
174 | 174 |
175 // Constructs the database manager. | 175 // Constructs the database manager. |
176 SafeBrowsingDatabaseManager( | 176 SafeBrowsingDatabaseManager( |
177 net::URLRequestContextGetter* request_context_getter, | 177 net::URLRequestContextGetter* request_context_getter, |
178 const V4GetHashProtocolConfig& config); | 178 const V4ProtocolConfig& config); |
179 | 179 |
180 virtual ~SafeBrowsingDatabaseManager(); | 180 virtual ~SafeBrowsingDatabaseManager(); |
181 | 181 |
182 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 182 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
183 | 183 |
184 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; | 184 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; |
185 }; // class SafeBrowsingDatabaseManager | 185 }; // class SafeBrowsingDatabaseManager |
186 | 186 |
187 } // namespace safe_browsing | 187 } // namespace safe_browsing |
188 | 188 |
189 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 189 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
OLD | NEW |