OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BR
OWSING_ACTIVATION_THROTTLE_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BR
OWSING_ACTIVATION_THROTTLE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "components/safe_browsing_db/database_manager.h" |
| 13 #include "content/public/browser/navigation_throttle.h" |
| 14 #include "url/gurl.h" |
| 15 |
| 16 namespace subresource_filter { |
| 17 |
| 18 // Navigation throttle responsible for activating subresource filtering on page |
| 19 // loads that match the SUBRESOURCE_FILTER Safe Browsing list. |
| 20 class SubresourceFilterSafeBrowsingActivationThrottle |
| 21 : public content::NavigationThrottle, |
| 22 public base::SupportsWeakPtr< |
| 23 SubresourceFilterSafeBrowsingActivationThrottle> { |
| 24 public: |
| 25 SubresourceFilterSafeBrowsingActivationThrottle( |
| 26 content::NavigationHandle* handle, |
| 27 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> |
| 28 database_manager); |
| 29 |
| 30 ~SubresourceFilterSafeBrowsingActivationThrottle() override; |
| 31 |
| 32 // content::NavigationThrottle: |
| 33 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() |
| 34 override; |
| 35 |
| 36 void OnCheckUrlResultOnUI(const GURL& url, |
| 37 safe_browsing::SBThreatType threat_type, |
| 38 safe_browsing::ThreatPatternType pattern_type); |
| 39 |
| 40 private: |
| 41 class SBDatabaseClient; |
| 42 |
| 43 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 44 std::unique_ptr<SBDatabaseClient, base::OnTaskRunnerDeleter> database_client_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(SubresourceFilterSafeBrowsingActivationThrottle); |
| 47 }; |
| 48 |
| 49 } // namespace subresource_filter |
| 50 |
| 51 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE
_BROWSING_ACTIVATION_THROTTLE_H_ |
OLD | NEW |