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 { |
| 24 class URLRequestContextGetter; |
| 25 } // namespace net |
| 26 |
23 namespace safe_browsing { | 27 namespace safe_browsing { |
24 | 28 |
| 29 struct V4GetHashProtocolConfig; |
| 30 class V4GetHashProtocolManager; |
| 31 |
25 // 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. |
26 class SafeBrowsingDatabaseManager | 33 class SafeBrowsingDatabaseManager |
27 : public base::RefCountedThreadSafe<SafeBrowsingDatabaseManager> { | 34 : public base::RefCountedThreadSafe<SafeBrowsingDatabaseManager> { |
28 public: | 35 public: |
29 // Callers requesting a result should derive from this class. | 36 // Callers requesting a result should derive from this class. |
30 // The destructor should call db_manager->CancelCheck(client) if a | 37 // The destructor should call db_manager->CancelCheck(client) if a |
31 // request is still pending. | 38 // request is still pending. |
32 class Client { | 39 class Client { |
33 public: | 40 public: |
34 virtual ~Client() {} | 41 virtual ~Client() {} |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // called multiple times during the life of the DatabaseManager. Must be | 146 // called multiple times during the life of the DatabaseManager. Must be |
140 // called on IO thread. | 147 // called on IO thread. |
141 virtual void StartOnIOThread() = 0; | 148 virtual void StartOnIOThread() = 0; |
142 | 149 |
143 // Called to stop or shutdown operations on the io_thread. This may be called | 150 // Called to stop or shutdown operations on the io_thread. This may be called |
144 // multiple times during the life of the DatabaseManager. Must be called | 151 // multiple times during the life of the DatabaseManager. Must be called |
145 // on IO thread. If shutdown is true, the manager is disabled permanently. | 152 // on IO thread. If shutdown is true, the manager is disabled permanently. |
146 virtual void StopOnIOThread(bool shutdown) = 0; | 153 virtual void StopOnIOThread(bool shutdown) = 0; |
147 | 154 |
148 protected: | 155 protected: |
149 virtual ~SafeBrowsingDatabaseManager() {} | 156 // Use this constructor for testing only. |
| 157 SafeBrowsingDatabaseManager(); |
| 158 |
| 159 // Constructs the database manager. |
| 160 SafeBrowsingDatabaseManager( |
| 161 net::URLRequestContextGetter* request_context_getter, |
| 162 const V4GetHashProtocolConfig& config); |
| 163 |
| 164 virtual ~SafeBrowsingDatabaseManager(); |
150 | 165 |
151 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 166 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
| 167 |
| 168 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; |
152 }; // class SafeBrowsingDatabaseManager | 169 }; // class SafeBrowsingDatabaseManager |
153 | 170 |
154 } // namespace safe_browsing | 171 } // namespace safe_browsing |
155 | 172 |
156 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 173 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
OLD | NEW |