Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Creates the safe browsing service. Need to initialize before using. |
| 100 explicit LocalSafeBrowsingDatabaseManager( | 101 explicit LocalSafeBrowsingDatabaseManager( |
|
Nathan Parker
2016/02/17 15:53:27
Can we get rid of the other constructor yet, to en
kcarattini
2016/02/17 22:44:42
I think having two is simpler so I don't have to g
kcarattini
2016/02/18 02:55:29
Done.
| |
| 101 const scoped_refptr<SafeBrowsingService>& service); | 102 const scoped_refptr<SafeBrowsingService>& service); |
| 102 | 103 |
| 104 LocalSafeBrowsingDatabaseManager( | |
| 105 const scoped_refptr<SafeBrowsingService>& service, | |
| 106 net::URLRequestContextGetter* request_context_getter, | |
| 107 const V4GetHashProtocolConfig& config); | |
| 108 | |
| 103 // | 109 // |
| 104 // SafeBrowsingDatabaseManager overrides | 110 // SafeBrowsingDatabaseManager overrides |
| 105 // | 111 // |
| 106 | 112 |
| 107 bool IsSupported() const override; | 113 bool IsSupported() const override; |
| 108 safe_browsing::ThreatSource GetThreatSource() const override; | 114 safe_browsing::ThreatSource GetThreatSource() const override; |
| 109 bool ChecksAreAlwaysAsync() const override; | 115 bool ChecksAreAlwaysAsync() const override; |
| 110 bool CanCheckResourceType(content::ResourceType resource_type) const override; | 116 bool CanCheckResourceType(content::ResourceType resource_type) const override; |
| 111 bool CanCheckUrl(const GURL& url) const override; | 117 bool CanCheckUrl(const GURL& url) const override; |
| 112 | 118 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 | 368 |
| 363 // Timeout to use for safe browsing checks. | 369 // Timeout to use for safe browsing checks. |
| 364 base::TimeDelta check_timeout_; | 370 base::TimeDelta check_timeout_; |
| 365 | 371 |
| 366 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager); | 372 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager); |
| 367 }; // class LocalSafeBrowsingDatabaseManager | 373 }; // class LocalSafeBrowsingDatabaseManager |
| 368 | 374 |
| 369 } // namespace safe_browsing | 375 } // namespace safe_browsing |
| 370 | 376 |
| 371 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ | 377 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ |
| OLD | NEW |