OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 PaintCompositorHostWindow(hWnd); | 1538 PaintCompositorHostWindow(hWnd); |
1539 return 0; | 1539 return 0; |
1540 default: | 1540 default: |
1541 return DefWindowProc(hWnd, message, wParam, lParam); | 1541 return DefWindowProc(hWnd, message, wParam, lParam); |
1542 } | 1542 } |
1543 } | 1543 } |
1544 | 1544 |
1545 // Creates a HWND within the RenderWidgetHostView that will serve as a host | 1545 // Creates a HWND within the RenderWidgetHostView that will serve as a host |
1546 // for a HWND that the GPU process will create. The host window is used | 1546 // for a HWND that the GPU process will create. The host window is used |
1547 // to Z-position the GPU's window relative to other plugin windows. | 1547 // to Z-position the GPU's window relative to other plugin windows. |
1548 gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositorHostWindow() { | 1548 gfx::PluginWindowHandle RenderWidgetHostViewWin::AcquireCompositingSurface() { |
1549 // If the window has been created, don't recreate it a second time | 1549 // If the window has been created, don't recreate it a second time |
1550 if (compositor_host_window_) | 1550 if (compositor_host_window_) |
1551 return compositor_host_window_; | 1551 return compositor_host_window_; |
1552 | 1552 |
1553 static ATOM window_class = 0; | 1553 static ATOM window_class = 0; |
1554 if (!window_class) { | 1554 if (!window_class) { |
1555 WNDCLASSEX wcex; | 1555 WNDCLASSEX wcex; |
1556 wcex.cbSize = sizeof(WNDCLASSEX); | 1556 wcex.cbSize = sizeof(WNDCLASSEX); |
1557 wcex.style = 0; | 1557 wcex.style = 0; |
1558 wcex.lpfnWndProc = CompositorHostWindowProc; | 1558 wcex.lpfnWndProc = CompositorHostWindowProc; |
(...skipping 18 matching lines...) Expand all Loading... |
1577 compositor_host_window_ = CreateWindowEx( | 1577 compositor_host_window_ = CreateWindowEx( |
1578 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 1578 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
1579 MAKEINTATOM(window_class), 0, | 1579 MAKEINTATOM(window_class), 0, |
1580 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, | 1580 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, |
1581 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); | 1581 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); |
1582 DCHECK(compositor_host_window_); | 1582 DCHECK(compositor_host_window_); |
1583 | 1583 |
1584 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_); | 1584 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_); |
1585 } | 1585 } |
1586 | 1586 |
| 1587 void RenderWidgetHostViewWin::ReleaseCompositingSurface( |
| 1588 gfx::PluginWindowHandle surface) { |
| 1589 ShowCompositorHostWindow(false); |
| 1590 } |
| 1591 |
1587 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { | 1592 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { |
1588 // When we first create the compositor, we will get a show request from | 1593 // When we first create the compositor, we will get a show request from |
1589 // the renderer before we have gotten the create request from the GPU. In this | 1594 // the renderer before we have gotten the create request from the GPU. In this |
1590 // case, simply ignore the show request. | 1595 // case, simply ignore the show request. |
1591 if (compositor_host_window_ == NULL) | 1596 if (compositor_host_window_ == NULL) |
1592 return; | 1597 return; |
1593 | 1598 |
1594 if (show) { | 1599 if (show) { |
1595 UINT flags = SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | | 1600 UINT flags = SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | |
1596 SWP_NOACTIVATE | SWP_DEFERERASE | SWP_SHOWWINDOW; | 1601 SWP_NOACTIVATE | SWP_DEFERERASE | SWP_SHOWWINDOW; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 } | 1814 } |
1810 | 1815 |
1811 // static | 1816 // static |
1812 RenderWidgetHostView* | 1817 RenderWidgetHostView* |
1813 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1818 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
1814 gfx::NativeView native_view) { | 1819 gfx::NativeView native_view) { |
1815 return ::IsWindow(native_view) ? | 1820 return ::IsWindow(native_view) ? |
1816 reinterpret_cast<RenderWidgetHostView*>( | 1821 reinterpret_cast<RenderWidgetHostView*>( |
1817 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1822 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
1818 } | 1823 } |
OLD | NEW |