| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/render_widget_host_view_win.h" | 5 #include "chrome/browser/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/gfx/gdi_util.h" | 8 #include "base/gfx/gdi_util.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 if (!handled_by_webcontents) { | 772 if (!handled_by_webcontents) { |
| 773 render_widget_host_->ForwardWheelEvent( | 773 render_widget_host_->ForwardWheelEvent( |
| 774 WebMouseWheelEvent(m_hWnd, message, wparam, lparam)); | 774 WebMouseWheelEvent(m_hWnd, message, wparam, lparam)); |
| 775 } | 775 } |
| 776 handled = TRUE; | 776 handled = TRUE; |
| 777 return 0; | 777 return 0; |
| 778 } | 778 } |
| 779 | 779 |
| 780 LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM, | 780 LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM, |
| 781 BOOL& handled) { | 781 BOOL& handled) { |
| 782 // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin | 782 HWND focus_window = GetFocus(); |
| 783 // child window. This is to ensure that keyboard events are received | 783 if (!::IsWindow(focus_window) || !IsChild(focus_window)) { |
| 784 // by the plugin. The correct way to fix this would be send over | 784 // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin |
| 785 // an event to the renderer which would then eventually send over | 785 // child window. This is to ensure that keyboard events are received |
| 786 // a setFocus call to the plugin widget. This would ensure that | 786 // by the plugin. The correct way to fix this would be send over |
| 787 // the renderer (webkit) knows about the plugin widget receiving | 787 // an event to the renderer which would then eventually send over |
| 788 // focus. | 788 // a setFocus call to the plugin widget. This would ensure that |
| 789 // TODO(iyengar) Do the right thing as per the above comment. | 789 // the renderer (webkit) knows about the plugin widget receiving |
| 790 POINT cursor_pos = {0}; | 790 // focus. |
| 791 ::GetCursorPos(&cursor_pos); | 791 // TODO(iyengar) Do the right thing as per the above comment. |
| 792 MapWindowPoints(m_hWnd, &cursor_pos, 1); | 792 POINT cursor_pos = {0}; |
| 793 HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos); | 793 ::GetCursorPos(&cursor_pos); |
| 794 if (::IsWindow(child_window)) { | 794 ::ScreenToClient(m_hWnd, &cursor_pos); |
| 795 ::SetFocus(child_window); | 795 HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos); |
| 796 return MA_NOACTIVATE; | 796 if (::IsWindow(child_window)) { |
| 797 } else { | 797 ::SetFocus(child_window); |
| 798 handled = FALSE; | 798 return MA_NOACTIVATE; |
| 799 return MA_ACTIVATE; | 799 } |
| 800 } | 800 } |
| 801 handled = FALSE; |
| 802 return MA_ACTIVATE; |
| 801 } | 803 } |
| 802 | 804 |
| 803 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, | 805 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, |
| 804 LPARAM lparam, BOOL& handled) { | 806 LPARAM lparam, BOOL& handled) { |
| 805 LRESULT reference_result = static_cast<LRESULT>(0L); | 807 LRESULT reference_result = static_cast<LRESULT>(0L); |
| 806 // TODO(jcampan): http://b/issue?id=1432077 Disabling accessibility in the | 808 // TODO(jcampan): http://b/issue?id=1432077 Disabling accessibility in the |
| 807 // renderer is a temporary work-around until that bug is fixed. | 809 // renderer is a temporary work-around until that bug is fixed. |
| 808 if (!renderer_accessible_) | 810 if (!renderer_accessible_) |
| 809 return reference_result; | 811 return reference_result; |
| 810 | 812 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 ::DestroyWindow(tooltip_hwnd_); | 909 ::DestroyWindow(tooltip_hwnd_); |
| 908 tooltip_hwnd_ = NULL; | 910 tooltip_hwnd_ = NULL; |
| 909 } | 911 } |
| 910 | 912 |
| 911 void RenderWidgetHostViewWin::ShutdownHost() { | 913 void RenderWidgetHostViewWin::ShutdownHost() { |
| 912 shutdown_factory_.RevokeAll(); | 914 shutdown_factory_.RevokeAll(); |
| 913 render_widget_host_->Shutdown(); | 915 render_widget_host_->Shutdown(); |
| 914 // Do not touch any members at this point, |this| has been deleted. | 916 // Do not touch any members at this point, |this| has been deleted. |
| 915 } | 917 } |
| 916 | 918 |
| OLD | NEW |