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

@ -15,12 +15,12 @@ namespace atom {
class OffScreenWebContentsView : public content::WebContentsView,
public content::RenderViewHostDelegateView {
public:
explicit OffScreenWebContentsView(bool transparent);
OffScreenWebContentsView(bool transparent, const OnPaintCallback& callback);
~OffScreenWebContentsView();
void SetWebContents(content::WebContents*);
// content::WebContentsView
// content::WebContentsView:
gfx::NativeView GetNativeView() const override;
gfx::NativeView GetContentNativeView() const override;
gfx::NativeWindow GetTopLevelNativeWindow() const override;
@ -62,6 +62,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
private:
const bool transparent_;
OnPaintCallback callback_;
// Weak refs.
OffScreenRenderWidgetHostView* view_;