2017-03-31 10:01:33 -03: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.
|
|
|
|
|
2020-02-04 12:19:40 -08:00
|
|
|
#ifndef SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|
|
|
|
#define SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|
2017-03-31 10:01:33 -03:00
|
|
|
|
2018-08-24 17:30:37 +02:00
|
|
|
#include <string>
|
|
|
|
|
2017-03-31 10:01:33 -03:00
|
|
|
#include "content/public/renderer/render_frame_observer.h"
|
2018-09-18 20:00:31 +02:00
|
|
|
#include "ipc/ipc_platform_file.h"
|
2019-06-19 13:46:59 -07:00
|
|
|
#include "shell/renderer/renderer_client_base.h"
|
2018-07-20 18:08:18 +02:00
|
|
|
#include "third_party/blink/public/web/web_local_frame.h"
|
2018-03-09 15:01:09 +05:30
|
|
|
|
|
|
|
namespace base {
|
|
|
|
class ListValue;
|
|
|
|
}
|
2017-03-31 10:01:33 -03:00
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2017-03-31 10:01:33 -03:00
|
|
|
|
|
|
|
// Helper class to forward the messages to the client.
|
2020-02-04 12:19:40 -08:00
|
|
|
class ElectronRenderFrameObserver : public content::RenderFrameObserver {
|
2017-03-31 10:01:33 -03:00
|
|
|
public:
|
2020-02-04 12:19:40 -08:00
|
|
|
ElectronRenderFrameObserver(content::RenderFrame* frame,
|
|
|
|
RendererClientBase* renderer_client);
|
2017-03-31 10:01:33 -03:00
|
|
|
|
|
|
|
// content::RenderFrameObserver:
|
|
|
|
void DidClearWindowObject() override;
|
2020-02-07 09:45:13 -08:00
|
|
|
void DidInstallConditionalFeatures(v8::Handle<v8::Context> context,
|
|
|
|
int world_id) override;
|
2017-08-31 19:51:40 +03:00
|
|
|
void DraggableRegionsChanged() override;
|
2017-03-31 10:01:33 -03:00
|
|
|
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
|
|
|
int world_id) override;
|
|
|
|
void OnDestruct() override;
|
2020-09-28 22:36:45 +02:00
|
|
|
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
|
2017-03-31 10:01:33 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool ShouldNotifyClient(int world_id);
|
|
|
|
void CreateIsolatedWorldContext();
|
|
|
|
bool IsMainWorld(int world_id);
|
|
|
|
bool IsIsolatedWorld(int world_id);
|
2018-09-18 20:00:31 +02:00
|
|
|
void OnTakeHeapSnapshot(IPC::PlatformFileForTransit file_handle,
|
|
|
|
const std::string& channel);
|
2018-03-09 14:22:44 +11:00
|
|
|
|
2017-03-31 10:01:33 -03:00
|
|
|
content::RenderFrame* render_frame_;
|
2017-04-08 11:27:19 -03:00
|
|
|
RendererClientBase* renderer_client_;
|
2017-03-31 10:01:33 -03:00
|
|
|
|
2020-02-04 12:19:40 -08:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(ElectronRenderFrameObserver);
|
2017-03-31 10:01:33 -03:00
|
|
|
};
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|
2017-03-31 10:01:33 -03:00
|
|
|
|
2020-02-04 12:19:40 -08:00
|
|
|
#endif // SHELL_RENDERER_ELECTRON_RENDER_FRAME_OBSERVER_H_
|