1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
fuchsia_web / webengine / renderer / web_engine_render_frame_observer.h [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FUCHSIA_WEB_WEBENGINE_RENDERER_WEB_ENGINE_RENDER_FRAME_OBSERVER_H_
#define FUCHSIA_WEB_WEBENGINE_RENDERER_WEB_ENGINE_RENDER_FRAME_OBSERVER_H_
#include "base/functional/callback.h"
#include "components/url_rewrite/renderer/url_request_rules_receiver.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/blink/public/common/tokens/tokens.h"
namespace content {
class RenderFrame;
} // namespace content
// This class owns WebEngine-specific objects whose lifespan is tied to a
// RenderFrame. Owned by WebEngineContentRendererClient, this object will be
// destroyed on `blink::WebLocalFrame` destruction, triggering the destruction
// of all of the objects it exposes.
class WebEngineRenderFrameObserver final : public content::RenderFrameObserver {
public:
// |on_render_frame_deleted_callback| must delete |this|.
WebEngineRenderFrameObserver(
content::RenderFrame* render_frame,
base::OnceCallback<void(const blink::LocalFrameToken&)>
on_render_frame_deleted_callback);
~WebEngineRenderFrameObserver() override;
WebEngineRenderFrameObserver(const WebEngineRenderFrameObserver&) = delete;
WebEngineRenderFrameObserver& operator=(const WebEngineRenderFrameObserver&) =
delete;
url_rewrite::UrlRequestRulesReceiver* url_request_rules_receiver() {
return &url_request_rules_receiver_;
}
private:
// content::RenderFrameObserver implementation.
void OnDestruct() override;
void WillDetach(blink::DetachReason detach_reason) override;
url_rewrite::UrlRequestRulesReceiver url_request_rules_receiver_;
base::OnceCallback<void(const blink::LocalFrameToken&)>
on_render_frame_deleted_callback_;
};
#endif // FUCHSIA_WEB_WEBENGINE_RENDERER_WEB_ENGINE_RENDER_FRAME_OBSERVER_H_