| 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/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 if (close_on_deactivate_ && | 816 if (close_on_deactivate_ && |
| 817 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || | 817 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || |
| 818 (message == WM_CHAR && wparam == L'\t'))) { | 818 (message == WM_CHAR && wparam == L'\t'))) { |
| 819 DCHECK(parent_hwnd_); | 819 DCHECK(parent_hwnd_); |
| 820 // First close the pop-up. | 820 // First close the pop-up. |
| 821 SendMessage(WM_CANCELMODE); | 821 SendMessage(WM_CANCELMODE); |
| 822 // Then move the focus by forwarding the tab key to the parent. | 822 // Then move the focus by forwarding the tab key to the parent. |
| 823 return ::SendMessage(parent_hwnd_, message, wparam, lparam); | 823 return ::SendMessage(parent_hwnd_, message, wparam, lparam); |
| 824 } | 824 } |
| 825 | 825 |
| 826 if (wparam == VK_SHIFT || wparam == VK_CONTROL) { |
| 827 // Bug 1845: we need to update the text direction when a user releases |
| 828 // either a right-shift key or a right-control key after pressing both of |
| 829 // them. So, we just update the text direction while a user is pressing the |
| 830 // keys, and we notify the text direction when a user releases either of |
| 831 // them. |
| 832 if (message == WM_KEYDOWN) { |
| 833 const int kKeyDownMask = 0x8000; |
| 834 if ((GetKeyState(VK_RSHIFT) & kKeyDownMask) && |
| 835 (GetKeyState(VK_RCONTROL) & kKeyDownMask)) { |
| 836 render_widget_host_->UpdateTextDirection(WEB_TEXT_DIRECTION_RTL); |
| 837 } else if ((GetKeyState(VK_LSHIFT) & kKeyDownMask) && |
| 838 (GetKeyState(VK_LCONTROL) & kKeyDownMask)) { |
| 839 render_widget_host_->UpdateTextDirection(WEB_TEXT_DIRECTION_LTR); |
| 840 } |
| 841 } else if (message == WM_KEYUP) { |
| 842 render_widget_host_->NotifyTextDirection(); |
| 843 } |
| 844 } |
| 845 |
| 826 render_widget_host_->ForwardKeyboardEvent( | 846 render_widget_host_->ForwardKeyboardEvent( |
| 827 NativeWebKeyboardEvent(m_hWnd, message, wparam, lparam)); | 847 NativeWebKeyboardEvent(m_hWnd, message, wparam, lparam)); |
| 828 return 0; | 848 return 0; |
| 829 } | 849 } |
| 830 | 850 |
| 831 LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, | 851 LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, |
| 832 LPARAM lparam, BOOL& handled) { | 852 LPARAM lparam, BOOL& handled) { |
| 833 // Workaround for Thinkpad mousewheel driver. We get mouse wheel/scroll | 853 // Workaround for Thinkpad mousewheel driver. We get mouse wheel/scroll |
| 834 // messages even if we are not in the foreground. So here we check if | 854 // messages even if we are not in the foreground. So here we check if |
| 835 // we have any owned popup windows in the foreground and dismiss them. | 855 // we have any owned popup windows in the foreground and dismiss them. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 // WM_LBUTTONDOWN. | 1055 // WM_LBUTTONDOWN. |
| 1036 SetFocus(); | 1056 SetFocus(); |
| 1037 } | 1057 } |
| 1038 } | 1058 } |
| 1039 | 1059 |
| 1040 void RenderWidgetHostViewWin::ShutdownHost() { | 1060 void RenderWidgetHostViewWin::ShutdownHost() { |
| 1041 shutdown_factory_.RevokeAll(); | 1061 shutdown_factory_.RevokeAll(); |
| 1042 render_widget_host_->Shutdown(); | 1062 render_widget_host_->Shutdown(); |
| 1043 // Do not touch any members at this point, |this| has been deleted. | 1063 // Do not touch any members at this point, |this| has been deleted. |
| 1044 } | 1064 } |
| OLD | NEW |