Chromium Code Reviews| 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/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.
| |
| 12 #include "components/subresource_filter/core/common/document_subresource_filter. h" | |
| 13 #include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h" | |
| 14 #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.
| |
| 15 #include "third_party/WebKit/public/platform/WebURLRequest.h" | |
| 16 #include "url/origin.h" | |
| 17 | |
| 18 namespace subresource_filter { | |
| 19 | |
| 20 class MemoryMappedRuleset; | |
| 21 | |
| 22 // Performs filtering of subresource loads in the scope of a given document. | |
| 23 class WebDocumentSubresourceFilterImpl | |
| 24 : public blink::WebDocumentSubresourceFilter, | |
| 25 public base::SupportsWeakPtr<WebDocumentSubresourceFilterImpl> { | |
| 26 public: | |
| 27 // See DocumentSubresourceFilter description. | |
| 28 // -- 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.
| |
| 29 // first disallowed subresource load. | |
| 30 WebDocumentSubresourceFilterImpl( | |
| 31 url::Origin document_origin, | |
| 32 ActivationState activation_state, | |
| 33 scoped_refptr<const MemoryMappedRuleset> ruleset, | |
| 34 base::OnceClosure first_disallowed_load_callback); | |
| 35 | |
| 36 ~WebDocumentSubresourceFilterImpl() override; | |
| 37 | |
| 38 const DocumentSubresourceFilter& filter() const { return filter_; } | |
| 39 | |
| 40 // blink::WebDocumentSubresourceFilter: | |
| 41 blink::WebDocumentSubresourceFilter::LoadPolicy getLoadPolicy( | |
| 42 const blink::WebURL& resourceUrl, | |
| 43 blink::WebURLRequest::RequestContext) override; | |
| 44 void reportDisallowedLoad() override; | |
| 45 | |
| 46 private: | |
| 47 DocumentSubresourceFilter filter_; | |
| 48 base::OnceClosure first_disallowed_load_callback_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(WebDocumentSubresourceFilterImpl); | |
| 51 }; | |
| 52 | |
| 53 } // namespace subresource_filter | |
| 54 | |
| 55 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_WEB_DOCUMENT_SUBRESOUR CE_FILTER_IMPL_H_ | |
| OLD | NEW |