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 SafeBrowsingDatabaseManager(); |
157 SafeBrowsingDatabaseManager( | |
158 net::URLRequestContextGetter* request_context_getter, | |
159 const V4GetHashProtocolConfig& config); | |
160 virtual ~SafeBrowsingDatabaseManager(); | |
150 | 161 |
151 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 162 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
163 | |
164 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; | |
Nathan Parker
2016/02/17 15:53:28
Hmm, didn't know we were using unique_ptr's (rathe
kcarattini
2016/02/18 02:55:29
Acknowledged.
| |
152 }; // class SafeBrowsingDatabaseManager | 165 }; // class SafeBrowsingDatabaseManager |
153 | 166 |
154 } // namespace safe_browsing | 167 } // namespace safe_browsing |
155 | 168 |
156 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 169 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
OLD | NEW |