| Index: components/subresource_filter/content/renderer/subresource_filter_agent.h
|
| diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.h b/components/subresource_filter/content/renderer/subresource_filter_agent.h
|
| index a93c77acce3b5bc827b3dd16a26a0c6ba4bc4c45..b89cd88cab0bce8208d07e56f7854d94c74d3693 100644
|
| --- a/components/subresource_filter/content/renderer/subresource_filter_agent.h
|
| +++ b/components/subresource_filter/content/renderer/subresource_filter_agent.h
|
| @@ -5,13 +5,23 @@
|
| #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_SUBRESOURCE_FILTER_AGENT_H_
|
| #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_RENDERER_SUBRESOURCE_FILTER_AGENT_H_
|
|
|
| +#include <memory>
|
| +#include <vector>
|
| +
|
| #include "base/macros.h"
|
| #include "components/subresource_filter/core/common/activation_state.h"
|
| #include "content/public/renderer/render_frame_observer.h"
|
|
|
| +class GURL;
|
| +
|
| +namespace blink {
|
| +class WebDocumentSubresourceFilter;
|
| +} // namespace blink
|
| +
|
| namespace subresource_filter {
|
|
|
| class RulesetDealer;
|
| +class DocumentSubresourceFilter;
|
|
|
| // The renderer-side agent of the ContentSubresourceFilterDriver. There is one
|
| // instance per RenderFrame, responsible for setting up the subresource filter
|
| @@ -19,22 +29,35 @@ class RulesetDealer;
|
| // so by the driver.
|
| class SubresourceFilterAgent : public content::RenderFrameObserver {
|
| public:
|
| + // The |ruleset_dealer| must not be null and must outlive this instance. The
|
| + // |render_frame| may be null in unittests.
|
| explicit SubresourceFilterAgent(content::RenderFrame* render_frame,
|
| RulesetDealer* ruleset_dealer);
|
| ~SubresourceFilterAgent() override;
|
|
|
| + protected:
|
| + // Returns the URLs of documents loaded into nested frames starting with the
|
| + // current frame and ending with the main frame. The returned array is
|
| + // guaranteed to have at least one element. Virtual so that it can be mocked
|
| + // out in tests.
|
| + virtual std::vector<GURL> GetAncestorDocumentURLs();
|
| +
|
| + // Injects the provided subresource |filter| into the DocumentLoader
|
| + // orchestrating the most recently committed load. Virtual so that it can be
|
| + // mocked out in tests.
|
| + virtual void SetSubresourceFilterForCommittedLoad(
|
| + std::unique_ptr<blink::WebDocumentSubresourceFilter> filter);
|
| +
|
| private:
|
| + void ActivateForProvisionalLoad(ActivationState activation_state);
|
| +
|
| // content::RenderFrameObserver:
|
| void OnDestruct() override;
|
| void DidStartProvisionalLoad() override;
|
| void DidCommitProvisionalLoad(bool is_new_navigation,
|
| bool is_same_page_navigation) override;
|
| -
|
| - // content::RenderFrameObserver:
|
| bool OnMessageReceived(const IPC::Message& message) override;
|
|
|
| - void OnActivateForProvisionalLoad(ActivationState activation_state);
|
| -
|
| // Owned by the ChromeContentRendererClient and outlives us.
|
| RulesetDealer* ruleset_dealer_;
|
|
|
|
|