Pass OnPaint callback in constructor

This can catch the paint events happened before onload event.
This commit is contained in:
Cheng Zhao 2016-08-04 13:03:24 +09:00
parent 32d9382417
commit 530fcc8de1
5 changed files with 21 additions and 29 deletions

View file

@ -6,8 +6,10 @@
namespace atom {
OffScreenWebContentsView::OffScreenWebContentsView(bool transparent)
OffScreenWebContentsView::OffScreenWebContentsView(
bool transparent, const OnPaintCallback& callback)
: transparent_(transparent),
callback_(callback),
web_contents_(nullptr) {
}
@ -66,8 +68,8 @@ content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForWidget(
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
view_ = new OffScreenRenderWidgetHostView(transparent_, render_widget_host,
relay->window.get());
view_ = new OffScreenRenderWidgetHostView(
transparent_, callback_, render_widget_host, relay->window.get());
return view_;
}
@ -75,8 +77,8 @@ content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForPopupWidget(
content::RenderWidgetHost* render_widget_host) {
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
view_ = new OffScreenRenderWidgetHostView(transparent_, render_widget_host,
relay->window.get());
view_ = new OffScreenRenderWidgetHostView(
transparent_, callback_, render_widget_host, relay->window.get());
return view_;
}