2017-03-31 07:01:33 -06:00
|
|
|
// Copyright (c) 2017 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 00:34:31 -07:00
|
|
|
#ifndef ELECTRON_SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|
|
|
|
#define ELECTRON_SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|
2017-03-31 07:01:33 -06:00
|
|
|
|
2018-08-24 09:30:37 -06:00
|
|
|
#include <string>
|
|
|
|
|
2017-03-31 07:01:33 -06:00
|
|
|
#include "content/public/renderer/render_frame_observer.h"
|
2018-09-18 12:00:31 -06:00
|
|
|
#include "ipc/ipc_platform_file.h"
|
2018-07-20 10:08:18 -06:00
|
|
|
#include "third_party/blink/public/web/web_local_frame.h"
|
2018-03-09 02:31:09 -07:00
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
namespace electron {
|
2017-03-31 07:01:33 -06:00
|
|
|
|
2021-07-01 18:51:37 -06:00
|
|
|
class RendererClientBase;
|
|
|
|
|
2017-03-31 07:01:33 -06:00
|
|
|
// Helper class to forward the messages to the client.
|
2024-05-21 13:21:31 -06:00
|
|
|
class ElectronRenderFrameObserver : private content::RenderFrameObserver {
|
2017-03-31 07:01:33 -06:00
|
|
|
public:
|
2020-02-04 13:19:40 -07:00
|
|
|
ElectronRenderFrameObserver(content::RenderFrame* frame,
|
|
|
|
RendererClientBase* renderer_client);
|
2017-03-31 07:01:33 -06:00
|
|
|
|
2021-11-03 05:41:45 -06:00
|
|
|
// disable copy
|
|
|
|
ElectronRenderFrameObserver(const ElectronRenderFrameObserver&) = delete;
|
|
|
|
ElectronRenderFrameObserver& operator=(const ElectronRenderFrameObserver&) =
|
|
|
|
delete;
|
|
|
|
|
2024-05-21 13:21:31 -06:00
|
|
|
private:
|
2017-03-31 07:01:33 -06:00
|
|
|
// content::RenderFrameObserver:
|
|
|
|
void DidClearWindowObject() override;
|
2020-02-07 10:45:13 -07:00
|
|
|
void DidInstallConditionalFeatures(v8::Handle<v8::Context> context,
|
|
|
|
int world_id) override;
|
2017-03-31 07:01:33 -06:00
|
|
|
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
|
|
|
int world_id) override;
|
|
|
|
void OnDestruct() override;
|
2020-09-28 14:36:45 -06:00
|
|
|
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
|
2017-03-31 07:01:33 -06:00
|
|
|
|
2024-02-20 05:29:11 -07:00
|
|
|
[[nodiscard]] bool ShouldNotifyClient(int world_id) const;
|
|
|
|
|
2017-03-31 07:01:33 -06:00
|
|
|
void CreateIsolatedWorldContext();
|
2018-09-18 12:00:31 -06:00
|
|
|
void OnTakeHeapSnapshot(IPC::PlatformFileForTransit file_handle,
|
|
|
|
const std::string& channel);
|
2018-03-08 20:22:44 -07:00
|
|
|
|
2021-12-05 20:54:14 -07:00
|
|
|
bool has_delayed_node_initialization_ = false;
|
2017-03-31 07:01:33 -06:00
|
|
|
content::RenderFrame* render_frame_;
|
2017-04-08 08:27:19 -06:00
|
|
|
RendererClientBase* renderer_client_;
|
2017-03-31 07:01:33 -06:00
|
|
|
};
|
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
} // namespace electron
|
2017-03-31 07:01:33 -06:00
|
|
|
|
2021-11-22 00:34:31 -07:00
|
|
|
#endif // ELECTRON_SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|