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 // Safe Browsing Database Manager implementation that manages a local | 5 // Safe Browsing Database Manager implementation that manages a local |
6 // database. This is used by Desktop Chromium. | 6 // database. This is used by Desktop Chromium. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 class URLRequestContext; | 34 class URLRequestContext; |
35 class URLRequestContextGetter; | 35 class URLRequestContextGetter; |
36 } | 36 } |
37 | 37 |
38 namespace safe_browsing { | 38 namespace safe_browsing { |
39 | 39 |
40 class SafeBrowsingService; | 40 class SafeBrowsingService; |
41 class SafeBrowsingDatabase; | 41 class SafeBrowsingDatabase; |
42 class ClientSideDetectionService; | 42 class ClientSideDetectionService; |
43 class DownloadProtectionService; | 43 class DownloadProtectionService; |
| 44 struct V4GetHashProtocolConfig; |
44 | 45 |
45 // Implemetation that manages a local database on disk. | 46 // Implemetation that manages a local database on disk. |
46 // | 47 // |
47 // Construction needs to happen on the main thread. | 48 // Construction needs to happen on the main thread. |
48 class LocalSafeBrowsingDatabaseManager | 49 class LocalSafeBrowsingDatabaseManager |
49 : public SafeBrowsingDatabaseManager, | 50 : public SafeBrowsingDatabaseManager, |
50 public SafeBrowsingProtocolManagerDelegate { | 51 public SafeBrowsingProtocolManagerDelegate { |
51 public: | 52 public: |
52 // Bundle of SafeBrowsing state while performing a URL or hash prefix check. | 53 // Bundle of SafeBrowsing state while performing a URL or hash prefix check. |
53 struct SafeBrowsingCheck { | 54 struct SafeBrowsingCheck { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // TODO(lzheng): We should consider to use this time out check | 90 // TODO(lzheng): We should consider to use this time out check |
90 // for browsing too (instead of implementing in | 91 // for browsing too (instead of implementing in |
91 // safe_browsing_resource_handler.cc). | 92 // safe_browsing_resource_handler.cc). |
92 scoped_ptr<base::WeakPtrFactory<LocalSafeBrowsingDatabaseManager>> | 93 scoped_ptr<base::WeakPtrFactory<LocalSafeBrowsingDatabaseManager>> |
93 weak_ptr_factory_; | 94 weak_ptr_factory_; |
94 | 95 |
95 private: | 96 private: |
96 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingCheck); | 97 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingCheck); |
97 }; | 98 }; |
98 | 99 |
99 // Creates the safe browsing service. Need to initialize before using. | 100 // Use this constructor for testing only. |
100 explicit LocalSafeBrowsingDatabaseManager( | 101 explicit LocalSafeBrowsingDatabaseManager( |
101 const scoped_refptr<SafeBrowsingService>& service); | 102 const scoped_refptr<SafeBrowsingService>& service); |
102 | 103 |
| 104 // Creates the safe browsing service. Need to initialize before using. |
| 105 LocalSafeBrowsingDatabaseManager( |
| 106 const scoped_refptr<SafeBrowsingService>& service, |
| 107 net::URLRequestContextGetter* request_context_getter, |
| 108 const V4GetHashProtocolConfig& config); |
| 109 |
103 // | 110 // |
104 // SafeBrowsingDatabaseManager overrides | 111 // SafeBrowsingDatabaseManager overrides |
105 // | 112 // |
106 | 113 |
107 bool IsSupported() const override; | 114 bool IsSupported() const override; |
108 safe_browsing::ThreatSource GetThreatSource() const override; | 115 safe_browsing::ThreatSource GetThreatSource() const override; |
109 bool ChecksAreAlwaysAsync() const override; | 116 bool ChecksAreAlwaysAsync() const override; |
110 bool CanCheckResourceType(content::ResourceType resource_type) const override; | 117 bool CanCheckResourceType(content::ResourceType resource_type) const override; |
111 bool CanCheckUrl(const GURL& url) const override; | 118 bool CanCheckUrl(const GURL& url) const override; |
112 | 119 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 369 |
363 // Timeout to use for safe browsing checks. | 370 // Timeout to use for safe browsing checks. |
364 base::TimeDelta check_timeout_; | 371 base::TimeDelta check_timeout_; |
365 | 372 |
366 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager); | 373 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager); |
367 }; // class LocalSafeBrowsingDatabaseManager | 374 }; // class LocalSafeBrowsingDatabaseManager |
368 | 375 |
369 } // namespace safe_browsing | 376 } // namespace safe_browsing |
370 | 377 |
371 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ | 378 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ |
OLD | NEW |