OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | 462 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
463 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 463 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
464 OnTextInputStateChanged) | 464 OnTextInputStateChanged) |
465 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) | 465 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) |
466 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) | 466 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) |
467 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, | 467 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, |
468 OnShowDisambiguationPopup) | 468 OnShowDisambiguationPopup) |
469 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) | 469 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) |
470 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 470 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
471 OnSelectionBoundsChanged) | 471 OnSelectionBoundsChanged) |
| 472 #if defined(OS_WIN) |
| 473 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated, |
| 474 OnWindowlessPluginDummyWindowCreated) |
| 475 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed, |
| 476 OnWindowlessPluginDummyWindowDestroyed) |
| 477 #endif |
472 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, | 478 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, |
473 OnImeCompositionRangeChanged) | 479 OnImeCompositionRangeChanged) |
474 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, | 480 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, |
475 OnFirstPaintAfterLoad) | 481 OnFirstPaintAfterLoad) |
476 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, | 482 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, |
477 OnForwardCompositorProto) | 483 OnForwardCompositorProto) |
478 IPC_MESSAGE_UNHANDLED(handled = false) | 484 IPC_MESSAGE_UNHANDLED(handled = false) |
479 IPC_END_MESSAGE_MAP() | 485 IPC_END_MESSAGE_MAP() |
480 | 486 |
481 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) | 487 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 // Aura-based systems will want to convert this to DIPs. | 1811 // Aura-based systems will want to convert this to DIPs. |
1806 if (view_) | 1812 if (view_) |
1807 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); | 1813 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); |
1808 | 1814 |
1809 // It is assumed that the disambiguation popup will make a copy of the | 1815 // It is assumed that the disambiguation popup will make a copy of the |
1810 // provided zoomed image, so we delete this one. | 1816 // provided zoomed image, so we delete this one. |
1811 zoomed_bitmap.setPixels(0); | 1817 zoomed_bitmap.setPixels(0); |
1812 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); | 1818 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); |
1813 } | 1819 } |
1814 | 1820 |
| 1821 #if defined(OS_WIN) |
| 1822 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( |
| 1823 gfx::NativeViewId dummy_activation_window) { |
| 1824 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
| 1825 |
| 1826 // This may happen as a result of a race condition when the plugin is going |
| 1827 // away. |
| 1828 wchar_t window_title[MAX_PATH + 1] = {0}; |
| 1829 if (!IsWindow(hwnd) || |
| 1830 !GetWindowText(hwnd, window_title, arraysize(window_title)) || |
| 1831 lstrcmpiW(window_title, kDummyActivationWindowName) != 0) { |
| 1832 return; |
| 1833 } |
| 1834 |
| 1835 #if defined(USE_AURA) |
| 1836 SetParent(hwnd, |
| 1837 reinterpret_cast<HWND>(view_->GetParentForWindowlessPlugin())); |
| 1838 #else |
| 1839 SetParent(hwnd, reinterpret_cast<HWND>(GetNativeViewId())); |
| 1840 #endif |
| 1841 dummy_windows_for_activation_.push_back(hwnd); |
| 1842 } |
| 1843 |
| 1844 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowDestroyed( |
| 1845 gfx::NativeViewId dummy_activation_window) { |
| 1846 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
| 1847 std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
| 1848 for (; i != dummy_windows_for_activation_.end(); ++i) { |
| 1849 if ((*i) == hwnd) { |
| 1850 dummy_windows_for_activation_.erase(i); |
| 1851 return; |
| 1852 } |
| 1853 } |
| 1854 NOTREACHED() << "Unknown dummy window"; |
| 1855 } |
| 1856 #endif |
| 1857 |
1815 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { | 1858 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { |
1816 ignore_input_events_ = ignore_input_events; | 1859 ignore_input_events_ = ignore_input_events; |
1817 } | 1860 } |
1818 | 1861 |
1819 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( | 1862 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( |
1820 const NativeWebKeyboardEvent& event) { | 1863 const NativeWebKeyboardEvent& event) { |
1821 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) | 1864 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) |
1822 return false; | 1865 return false; |
1823 | 1866 |
1824 for (size_t i = 0; i < key_press_event_callbacks_.size(); i++) { | 1867 for (size_t i = 0; i < key_press_event_callbacks_.size(); i++) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 } | 2234 } |
2192 | 2235 |
2193 #if defined(OS_WIN) | 2236 #if defined(OS_WIN) |
2194 gfx::NativeViewAccessible | 2237 gfx::NativeViewAccessible |
2195 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2238 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2196 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2239 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2197 } | 2240 } |
2198 #endif | 2241 #endif |
2199 | 2242 |
2200 } // namespace content | 2243 } // namespace content |
OLD | NEW |