Chromium Code Reviews| Index: components/subresource_filter/content/browser/subframe_filtering_navigation_throttle.h |
| diff --git a/components/subresource_filter/content/browser/subframe_filtering_navigation_throttle.h b/components/subresource_filter/content/browser/subframe_filtering_navigation_throttle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e0fac9b7d83865023f6bb2425d155c669a87cc94 |
| --- /dev/null |
| +++ b/components/subresource_filter/content/browser/subframe_filtering_navigation_throttle.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 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_SUBFRAME_BLOCKING_NAVIGATION_THROTTLE_H_ |
| +#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_BLOCKING_NAVIGATION_THROTTLE_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "content/public/browser/navigation_throttle.h" |
| +#include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h" |
| + |
| +namespace content { |
| +class NavigationHandle; |
| +} // namespace content |
| + |
| +namespace subresource_filter { |
| + |
| +class AsyncDocumentSubresourceFilter; |
| + |
| +// NavigationThrottle responsible for determining the activation level for a |
| +// given frame (including main frames and subframes). This class should only be |
| +// created for subframe navigations occuring in document's which are already |
|
pkalinnikov
2017/02/14 12:11:07
nit: s/document's/documents/
Charlie Harrison
2017/02/14 14:09:38
Done.
|
| +// activated and have associated DocumentSubresourceFilters. |
|
pkalinnikov
2017/02/14 12:11:07
Phrasing suggestion:
NavigationThrottle responsib
Charlie Harrison
2017/02/14 14:09:38
Reworded even more, because this class *doesn't* d
|
| +class SubframeFilteringNavigationThrottle : public content::NavigationThrottle { |
| + public: |
| + SubframeFilteringNavigationThrottle( |
| + content::NavigationHandle* handle, |
| + AsyncDocumentSubresourceFilter* async_filter); |
|
pkalinnikov
2017/02/14 12:11:07
nit: Please call this consistently with the stored
Charlie Harrison
2017/02/14 14:09:38
Done.
|
| + ~SubframeFilteringNavigationThrottle() override; |
| + |
| + // content::NavigationThrottle: |
| + content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
| + content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest() |
| + override; |
| + |
| + private: |
| + content::NavigationThrottle::ThrottleCheckResult DeferToCalculateLoadPolicy(); |
| + void OnCalculatedLoadPolicy( |
| + blink::WebDocumentSubresourceFilter::LoadPolicy policy); |
| + |
| + // Must outlive this class. |
| + AsyncDocumentSubresourceFilter* parent_filter_; |
| + |
| + base::WeakPtrFactory<SubframeFilteringNavigationThrottle> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SubframeFilteringNavigationThrottle); |
| +}; |
| + |
| +} // namespace subresource_filter |
| + |
| +#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_BLOCKING_NAVIGATION_THROTTLE_H_ |