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 | |
478 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, | 472 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, |
479 OnImeCompositionRangeChanged) | 473 OnImeCompositionRangeChanged) |
480 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, | 474 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, |
481 OnFirstPaintAfterLoad) | 475 OnFirstPaintAfterLoad) |
482 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, | 476 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, |
483 OnForwardCompositorProto) | 477 OnForwardCompositorProto) |
484 IPC_MESSAGE_UNHANDLED(handled = false) | 478 IPC_MESSAGE_UNHANDLED(handled = false) |
485 IPC_END_MESSAGE_MAP() | 479 IPC_END_MESSAGE_MAP() |
486 | 480 |
487 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) | 481 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 // Aura-based systems will want to convert this to DIPs. | 1805 // Aura-based systems will want to convert this to DIPs. |
1812 if (view_) | 1806 if (view_) |
1813 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); | 1807 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); |
1814 | 1808 |
1815 // It is assumed that the disambiguation popup will make a copy of the | 1809 // It is assumed that the disambiguation popup will make a copy of the |
1816 // provided zoomed image, so we delete this one. | 1810 // provided zoomed image, so we delete this one. |
1817 zoomed_bitmap.setPixels(0); | 1811 zoomed_bitmap.setPixels(0); |
1818 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); | 1812 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); |
1819 } | 1813 } |
1820 | 1814 |
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 | |
1858 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { | 1815 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { |
1859 ignore_input_events_ = ignore_input_events; | 1816 ignore_input_events_ = ignore_input_events; |
1860 } | 1817 } |
1861 | 1818 |
1862 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( | 1819 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( |
1863 const NativeWebKeyboardEvent& event) { | 1820 const NativeWebKeyboardEvent& event) { |
1864 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) | 1821 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) |
1865 return false; | 1822 return false; |
1866 | 1823 |
1867 for (size_t i = 0; i < key_press_event_callbacks_.size(); i++) { | 1824 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... |
2234 } | 2191 } |
2235 | 2192 |
2236 #if defined(OS_WIN) | 2193 #if defined(OS_WIN) |
2237 gfx::NativeViewAccessible | 2194 gfx::NativeViewAccessible |
2238 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2195 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2239 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2196 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2240 } | 2197 } |
2241 #endif | 2198 #endif |
2242 | 2199 |
2243 } // namespace content | 2200 } // namespace content |
OLD | NEW |