Chromium Code Reviews| Index: components/subresource_filter/content/renderer/web_document_subresource_filter_impl.h |
| diff --git a/components/subresource_filter/content/renderer/web_document_subresource_filter_impl.h b/components/subresource_filter/content/renderer/web_document_subresource_filter_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..54e7b2dea30db14fccc441e2452d1a1eb662a52c |
| --- /dev/null |
| +++ b/components/subresource_filter/content/renderer/web_document_subresource_filter_impl.h |
| @@ -0,0 +1,55 @@ |
| +// 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_RENDERER_WEB_DOCUMENT_SUBRESOURCE_FILTER_IMPL_H_ |
| +#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_WEB_DOCUMENT_SUBRESOURCE_FILTER_IMPL_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "components/subresource_filter/core/common/activation_state.h" |
|
engedy
2017/02/17 16:44:04
nit: Move this, WebURL.h, WebURLRequest.h, and ori
pkalinnikov
2017/02/17 17:16:48
Done.
|
| +#include "components/subresource_filter/core/common/document_subresource_filter.h" |
| +#include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h" |
| +#include "third_party/WebKit/public/platform/WebURL.h" |
|
engedy
2017/02/17 16:44:04
nit: Move this and the next to the impl. Here we a
pkalinnikov
2017/02/17 17:16:48
Done.
|
| +#include "third_party/WebKit/public/platform/WebURLRequest.h" |
| +#include "url/origin.h" |
| + |
| +namespace subresource_filter { |
| + |
| +class MemoryMappedRuleset; |
| + |
| +// Performs filtering of subresource loads in the scope of a given document. |
| +class WebDocumentSubresourceFilterImpl |
| + : public blink::WebDocumentSubresourceFilter, |
| + public base::SupportsWeakPtr<WebDocumentSubresourceFilterImpl> { |
| + public: |
| + // See DocumentSubresourceFilter description. |
| + // -- Invoke |first_disallowed_load_callback|, if it is non-null, on the |
|
engedy
2017/02/17 16:44:04
nit: Remove -- for list of one item:
Invokes ...
pkalinnikov
2017/02/17 17:16:48
Done.
|
| + // first disallowed subresource load. |
| + WebDocumentSubresourceFilterImpl( |
| + url::Origin document_origin, |
| + ActivationState activation_state, |
| + scoped_refptr<const MemoryMappedRuleset> ruleset, |
| + base::OnceClosure first_disallowed_load_callback); |
| + |
| + ~WebDocumentSubresourceFilterImpl() override; |
| + |
| + const DocumentSubresourceFilter& filter() const { return filter_; } |
| + |
| + // blink::WebDocumentSubresourceFilter: |
| + blink::WebDocumentSubresourceFilter::LoadPolicy getLoadPolicy( |
| + const blink::WebURL& resourceUrl, |
| + blink::WebURLRequest::RequestContext) override; |
| + void reportDisallowedLoad() override; |
| + |
| + private: |
| + DocumentSubresourceFilter filter_; |
| + base::OnceClosure first_disallowed_load_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebDocumentSubresourceFilterImpl); |
| +}; |
| + |
| +} // namespace subresource_filter |
| + |
| +#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_WEB_DOCUMENT_SUBRESOURCE_FILTER_IMPL_H_ |