OLD | NEW |
(Empty) | |
| 1 // Copyright 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_RENDERER_WEB_DOCUMENT_SUBRESOURCE_
FILTER_IMPL_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_WEB_DOCUMENT_SUBRESOURCE_
FILTER_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/subresource_filter/core/common/document_subresource_filter.
h" |
| 12 #include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h" |
| 13 |
| 14 namespace subresource_filter { |
| 15 |
| 16 class MemoryMappedRuleset; |
| 17 |
| 18 // Performs filtering of subresource loads in the scope of a given document. |
| 19 class WebDocumentSubresourceFilterImpl |
| 20 : public blink::WebDocumentSubresourceFilter, |
| 21 public base::SupportsWeakPtr<WebDocumentSubresourceFilterImpl> { |
| 22 public: |
| 23 // See DocumentSubresourceFilter description. |
| 24 // |
| 25 // Invokes |first_disallowed_load_callback|, if it is non-null, on the first |
| 26 // reportDisallowedLoad() call. |
| 27 WebDocumentSubresourceFilterImpl( |
| 28 url::Origin document_origin, |
| 29 ActivationState activation_state, |
| 30 scoped_refptr<const MemoryMappedRuleset> ruleset, |
| 31 base::OnceClosure first_disallowed_load_callback); |
| 32 |
| 33 ~WebDocumentSubresourceFilterImpl() override; |
| 34 |
| 35 const DocumentSubresourceFilter& filter() const { return filter_; } |
| 36 |
| 37 // blink::WebDocumentSubresourceFilter: |
| 38 blink::WebDocumentSubresourceFilter::LoadPolicy getLoadPolicy( |
| 39 const blink::WebURL& resourceUrl, |
| 40 blink::WebURLRequest::RequestContext) override; |
| 41 void reportDisallowedLoad() override; |
| 42 |
| 43 private: |
| 44 DocumentSubresourceFilter filter_; |
| 45 base::OnceClosure first_disallowed_load_callback_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(WebDocumentSubresourceFilterImpl); |
| 48 }; |
| 49 |
| 50 } // namespace subresource_filter |
| 51 |
| 52 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_WEB_DOCUMENT_SUBRESOUR
CE_FILTER_IMPL_H_ |
OLD | NEW |