OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_view_win.h" | 5 #include "content/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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 case WM_MBUTTONDOWN: | 193 case WM_MBUTTONDOWN: |
194 ::SendMessage(GetParent(window), message, wparam, lparam); | 194 ::SendMessage(GetParent(window), message, wparam, lparam); |
195 return 0; | 195 return 0; |
196 default: | 196 default: |
197 break; | 197 break; |
198 } | 198 } |
199 } | 199 } |
200 return ::DefWindowProc(window, message, wparam, lparam); | 200 return ::DefWindowProc(window, message, wparam, lparam); |
201 } | 201 } |
202 | 202 |
203 // Must be dynamically loaded to avoid startup failures on Win XP. | |
204 typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)( | |
205 HWND hwnd, | |
206 UINT message, | |
207 DWORD action, | |
208 PCHANGEFILTERSTRUCT change_filter_struct); | |
209 ChangeWindowMessageFilterExFunction g_ChangeWindowMessageFilterEx; | |
210 | |
211 } // namespace | 203 } // namespace |
212 | 204 |
213 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
214 // RenderWidgetHostViewWin, public: | 206 // RenderWidgetHostViewWin, public: |
215 | 207 |
216 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) | 208 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) |
217 : render_widget_host_(widget), | 209 : render_widget_host_(widget), |
218 compositor_host_window_(NULL), | 210 compositor_host_window_(NULL), |
219 hide_compositor_window_at_next_paint_(false), | 211 hide_compositor_window_at_next_paint_(false), |
220 track_mouse_leave_(false), | 212 track_mouse_leave_(false), |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 433 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
442 MAKEINTATOM(window_class), 0, | 434 MAKEINTATOM(window_class), 0, |
443 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 435 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
444 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0); | 436 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0); |
445 ui::CheckWindowCreated(parent); | 437 ui::CheckWindowCreated(parent); |
446 // If UIPI is enabled we need to add message filters for parents with | 438 // If UIPI is enabled we need to add message filters for parents with |
447 // children that cross process boundaries. | 439 // children that cross process boundaries. |
448 if (::GetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp)) { | 440 if (::GetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp)) { |
449 // Process-wide message filters required on Vista must be added to: | 441 // Process-wide message filters required on Vista must be added to: |
450 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | 442 // chrome_content_client.cc ChromeContentClient::SandboxPlugin |
451 if (!g_ChangeWindowMessageFilterEx) { | 443 ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); |
452 g_ChangeWindowMessageFilterEx = | 444 ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); |
453 reinterpret_cast<ChangeWindowMessageFilterExFunction>( | 445 ChangeWindowMessageFilterEx(parent, WM_APPCOMMAND, MSGFLT_ALLOW, NULL); |
454 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), | |
455 "ChangeWindowMessageFilterEx")); | |
456 } | |
457 // Process-wide message filters required on Vista must be added to: | |
458 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | |
459 g_ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); | |
460 g_ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); | |
461 g_ChangeWindowMessageFilterEx(parent, WM_APPCOMMAND, MSGFLT_ALLOW, NULL); | |
462 ::RemovePropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp); | 446 ::RemovePropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp); |
463 } | 447 } |
464 ::SetParent(window, parent); | 448 ::SetParent(window, parent); |
465 BrowserThread::PostTask( | 449 BrowserThread::PostTask( |
466 BrowserThread::IO, FROM_HERE, | 450 BrowserThread::IO, FROM_HERE, |
467 new NotifyPluginProcessHostTask(window, parent)); | 451 new NotifyPluginProcessHostTask(window, parent)); |
468 return parent; | 452 return parent; |
469 } | 453 } |
470 | 454 |
471 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 455 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 if (message == WM_MOUSEMOVE) { | 1924 if (message == WM_MOUSEMOVE) { |
1941 CPoint center = GetClientCenter(); | 1925 CPoint center = GetClientCenter(); |
1942 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). | 1926 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). |
1943 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) | 1927 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) |
1944 return; | 1928 return; |
1945 } | 1929 } |
1946 | 1930 |
1947 ForwardMouseEventToRenderer(message, wparam, lparam); | 1931 ForwardMouseEventToRenderer(message, wparam, lparam); |
1948 } | 1932 } |
1949 | 1933 |
OLD | NEW |