Chromium Code Reviews| Index: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h |
| diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d898724383bbf2e06795867e6f802115f447b9c8 |
| --- /dev/null |
| +++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_ |
| +#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "components/safe_browsing_db/database_manager.h" |
|
engedy
2017/03/10 14:39:33
nit: This include could be avoided if we fwd-decla
melandory
2017/03/15 13:41:36
For some weird reason it doesn't work
|
| +#include "content/public/browser/navigation_throttle.h" |
| +#include "url/gurl.h" |
| + |
| +namespace subresource_filter { |
| + |
| +// Client for accessing list with patterns to be used by the Subresource Filter. |
| +class SubresourceFilterSafeBrowsingActivationThrottle |
| + : public content::NavigationThrottle, |
| + public base::SupportsWeakPtr< |
| + SubresourceFilterSafeBrowsingActivationThrottle> { |
| + public: |
| + SubresourceFilterSafeBrowsingActivationThrottle( |
| + content::NavigationHandle* handle, |
| + const scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>& |
|
engedy
2017/03/10 14:39:33
style nit: According to [1], the new preferred way
|
| + database_manager); |
| + |
| + ~SubresourceFilterSafeBrowsingActivationThrottle() override; |
| + |
| + // content::NavigationThrottle: |
| + content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() |
| + override; |
| + |
| + void OnCheckUrlResultOnUI(const GURL& url, |
| + safe_browsing::SBThreatType threat_type, |
| + safe_browsing::ThreatPatternType pattern_type); |
| + |
| + private: |
| + class ActivationClient; |
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + std::unique_ptr<ActivationClient, base::OnTaskRunnerDeleter> |
| + activation_client_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SubresourceFilterSafeBrowsingActivationThrottle); |
| +}; |
| + |
| +} // namespace subresource_filter |
| + |
| +#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_ |