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..3b594b9d8b3955d97b1976c3d93f80dec5382f40 |
| --- /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 filtering direct subframe navigations |
|
engedy
2017/02/14 22:04:33
Comment wording ideas:
NavigationThrottle respons
Charlie Harrison
2017/02/14 23:06:55
Nice, done
|
| +// associated with activated frames. It should only be instantiated for |
| +// subframe navigations occuring in documents which already have filtering |
| +// activated and an associated (Async)DocumentSubresourceFilter. |
| +class SubframeFilteringNavigationThrottle : public content::NavigationThrottle { |
|
engedy
2017/02/14 22:04:33
This name is somewhat ambiguous, what do you think
Charlie Harrison
2017/02/14 23:06:55
I prefer SubframeNavigationFilteringThrottle, chan
|
| + public: |
| + SubframeFilteringNavigationThrottle( |
| + content::NavigationHandle* handle, |
| + AsyncDocumentSubresourceFilter* parent_filter); |
|
engedy
2017/02/14 22:04:33
nit: How about calling this more specifically pare
Charlie Harrison
2017/02/14 23:06:55
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_ |