add "view-painted" event to WebContent.
This commit is contained in:
parent
08491e1ceb
commit
d335d7d706
6 changed files with 19 additions and 0 deletions
|
@ -733,6 +733,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||||
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
|
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
|
||||||
OnRendererMessageSync)
|
OnRendererMessageSync)
|
||||||
|
IPC_MESSAGE_HANDLER(AtomViewHostMsg_DidCommitCompositorFrame, OnViewPainted)
|
||||||
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
|
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
|
||||||
handled = false)
|
handled = false)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
|
@ -1298,6 +1299,10 @@ void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::OnViewPainted() {
|
||||||
|
Emit("view-painted");
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::SetSize(const SetSizeParams& params) {
|
void WebContents::SetSize(const SetSizeParams& params) {
|
||||||
if (guest_delegate_)
|
if (guest_delegate_)
|
||||||
guest_delegate_->SetSize(params);
|
guest_delegate_->SetSize(params);
|
||||||
|
|
|
@ -294,6 +294,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
const base::ListValue& args,
|
const base::ListValue& args,
|
||||||
IPC::Message* message);
|
IPC::Message* message);
|
||||||
|
|
||||||
|
// Called when the hosted view gets graphical updates.
|
||||||
|
void OnViewPainted();
|
||||||
|
|
||||||
v8::Global<v8::Value> session_;
|
v8::Global<v8::Value> session_;
|
||||||
v8::Global<v8::Value> devtools_web_contents_;
|
v8::Global<v8::Value> devtools_web_contents_;
|
||||||
v8::Global<v8::Value> debugger_;
|
v8::Global<v8::Value> debugger_;
|
||||||
|
|
|
@ -39,5 +39,7 @@ IPC_MESSAGE_ROUTED3(AtomViewMsg_Message,
|
||||||
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions,
|
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions,
|
||||||
std::vector<atom::DraggableRegion> /* regions */)
|
std::vector<atom::DraggableRegion> /* regions */)
|
||||||
|
|
||||||
|
IPC_MESSAGE_ROUTED0(AtomViewHostMsg_DidCommitCompositorFrame)
|
||||||
|
|
||||||
// Update renderer process preferences.
|
// Update renderer process preferences.
|
||||||
IPC_MESSAGE_CONTROL1(AtomMsg_UpdatePreferences, base::ListValue)
|
IPC_MESSAGE_CONTROL1(AtomMsg_UpdatePreferences, base::ListValue)
|
||||||
|
|
|
@ -141,6 +141,10 @@ void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
|
||||||
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomRenderViewObserver::DidCommitCompositorFrame() {
|
||||||
|
Send(new AtomViewHostMsg_DidCommitCompositorFrame(routing_id()));
|
||||||
|
}
|
||||||
|
|
||||||
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
||||||
|
|
|
@ -28,6 +28,7 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
|
||||||
// content::RenderViewObserver implementation.
|
// content::RenderViewObserver implementation.
|
||||||
void DidCreateDocumentElement(blink::WebLocalFrame* frame) override;
|
void DidCreateDocumentElement(blink::WebLocalFrame* frame) override;
|
||||||
void DraggableRegionsChanged(blink::WebFrame* frame) override;
|
void DraggableRegionsChanged(blink::WebFrame* frame) override;
|
||||||
|
void DidCommitCompositorFrame() override;
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
bool OnMessageReceived(const IPC::Message& message) override;
|
||||||
|
|
||||||
void OnBrowserMessage(bool send_to_all,
|
void OnBrowserMessage(bool send_to_all,
|
||||||
|
|
|
@ -448,6 +448,10 @@ app.on('ready', () => {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Event: 'view-painted'
|
||||||
|
|
||||||
|
Emitted when a page's view is repainted.
|
||||||
|
|
||||||
### Instance Methods
|
### Instance Methods
|
||||||
|
|
||||||
#### `contents.loadURL(url[, options])`
|
#### `contents.loadURL(url[, options])`
|
||||||
|
|
Loading…
Reference in a new issue