Emit("hide");
}
+void Window::OnReadyToShow() {
+ Emit("ready-to-show");
+}
+
void Window::OnWindowMaximize() {
Emit("maximize");
}
void OnWindowFocus() override;
void OnWindowShow() override;
void OnWindowHide() override;
+ void OnReadyToShow() override;
void OnWindowMaximize() override;
void OnWindowUnmaximize() override;
void OnWindowMinimize() override;
window_unresposive_closure_.Cancel();
}
+void NativeWindow::DidFirstVisuallyNonEmptyPaint() {
+ // When there is a non-empty first paint, resize the RenderWidget to force
+ // Chromium to draw.
+ const auto view = web_contents()->GetRenderWidgetHostView();
+ view->Show();
+ view->SetSize(GetContentSize());
+
+ // Emit the ReadyToShow event in next tick in case of pending drawing work.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
+}
+
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
OnRendererUnresponsive());
}
+void NativeWindow::NotifyReadyToShow() {
+ FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnReadyToShow());
+}
+
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
const SkBitmap& bitmap,
content::ReadbackResponse response) {
// content::WebContentsObserver:
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BeforeUnloadDialogCancelled() override;
+ void DidFirstVisuallyNonEmptyPaint() override;
bool OnMessageReceived(const IPC::Message& message) override;
private:
// Dispatch unresponsive event to observers.
void NotifyWindowUnresponsive();
+ // Dispatch ReadyToShow event to observers.
+ void NotifyReadyToShow();
+
// Called when CapturePage has done.
void OnCapturePageDone(const CapturePageCallback& callback,
const SkBitmap& bitmap,
// Called when window is hidden.
virtual void OnWindowHide() {}
+ // Called when window is ready to show.
+ virtual void OnReadyToShow() {}
+
// Called when window state changed.
virtual void OnWindowMaximize() {}
virtual void OnWindowUnmaximize() {}