OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Implementation of the SafeBrowsingDatabaseManager that sends URLs | 5 // Implementation of the SafeBrowsingDatabaseManager that sends URLs |
6 // via IPC to a database that chromium doesn't manage locally. | 6 // via IPC to a database that chromium doesn't manage locally. |
7 | 7 |
8 #ifndef COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ |
9 #define COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | 9 #define COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "components/safe_browsing_db/database_manager.h" | 18 #include "components/safe_browsing_db/database_manager.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
23 } | 23 } |
24 | 24 |
25 namespace safe_browsing { | 25 namespace safe_browsing { |
26 | 26 |
27 struct V4GetHashProtocolConfig; | 27 struct V4ProtocolConfig; |
28 | 28 |
29 // An implementation that proxies requests to a service outside of Chromium. | 29 // An implementation that proxies requests to a service outside of Chromium. |
30 // Does not manage a local database. | 30 // Does not manage a local database. |
31 class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { | 31 class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { |
32 public: | 32 public: |
33 // Use this constructor for testing only. | 33 // Use this constructor for testing only. |
34 RemoteSafeBrowsingDatabaseManager(); | 34 RemoteSafeBrowsingDatabaseManager(); |
35 | 35 |
36 // Construct RemoteSafeBrowsingDatabaseManager. | 36 // Construct RemoteSafeBrowsingDatabaseManager. |
37 // Must be initialized by calling StartOnIOThread() before using. | 37 // Must be initialized by calling StartOnIOThread() before using. |
38 RemoteSafeBrowsingDatabaseManager( | 38 RemoteSafeBrowsingDatabaseManager( |
39 net::URLRequestContextGetter* request_context_getter, | 39 net::URLRequestContextGetter* request_context_getter, |
40 const V4GetHashProtocolConfig& config); | 40 const V4ProtocolConfig& config); |
41 | 41 |
42 // | 42 // |
43 // SafeBrowsingDatabaseManager implementation | 43 // SafeBrowsingDatabaseManager implementation |
44 // | 44 // |
45 | 45 |
46 bool IsSupported() const override; | 46 bool IsSupported() const override; |
47 safe_browsing::ThreatSource GetThreatSource() const override; | 47 safe_browsing::ThreatSource GetThreatSource() const override; |
48 bool ChecksAreAlwaysAsync() const override; | 48 bool ChecksAreAlwaysAsync() const override; |
49 bool CanCheckResourceType(content::ResourceType resource_type) const override; | 49 bool CanCheckResourceType(content::ResourceType resource_type) const override; |
50 bool CanCheckUrl(const GURL& url) const override; | 50 bool CanCheckUrl(const GURL& url) const override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 std::set<content::ResourceType> resource_types_to_check_; | 85 std::set<content::ResourceType> resource_types_to_check_; |
86 | 86 |
87 friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>; | 87 friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>; |
88 DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager); | 88 DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager); |
89 }; // class RemoteSafeBrowsingDatabaseManager | 89 }; // class RemoteSafeBrowsingDatabaseManager |
90 | 90 |
91 } // namespace safe_browsing | 91 } // namespace safe_browsing |
92 | 92 |
93 #endif // COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | 93 #endif // COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ |
OLD | NEW |