electron/atom/browser/osr_render_widget_host_view_win.cc

47 lines
1 KiB
C++
Raw Normal View History

2016-07-13 15:43:00 +00:00
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <windows.h>
2016-07-29 12:50:27 +00:00
#include "atom/browser/osr_render_widget_host_view.h"
2016-07-13 15:43:00 +00:00
namespace atom {
class DummyWindowWin : public gfx::WindowImpl {
public:
DummyWindowWin() {
// Create a hidden 1x1 borderless window.
set_window_style(WS_POPUP | WS_SYSMENU);
Init(NULL, gfx::Rect(0, 0, 1, 1));
}
~DummyWindowWin() override {
DestroyWindow(hwnd());
}
private:
CR_BEGIN_MSG_MAP_EX(DummyWindowWin)
CR_MSG_WM_PAINT(OnPaint)
CR_END_MSG_MAP()
void OnPaint(HDC dc) {
ValidateRect(hwnd(), NULL);
}
DISALLOW_COPY_AND_ASSIGN(DummyWindowWin);
};
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::CreatePlatformWidget() {
2016-07-13 15:43:00 +00:00
DCHECK(!window_);
window_.reset(new DummyWindowWin());
compositor_widget_ = window_->hwnd();
}
2016-07-29 22:51:19 +00:00
void OffScreenRenderWidgetHostView::DestroyPlatformWidget() {
window_.reset(NULL);
compositor_widget_ = gfx::kNullAcceleratedWidget;
}
2016-07-13 15:43:00 +00:00
} // namespace atom