Chromium Code Reviews| 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 "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 <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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 wcex.hIcon = 0; | 439 wcex.hIcon = 0; |
| 440 wcex.hCursor = 0; | 440 wcex.hCursor = 0; |
| 441 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); | 441 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); |
| 442 wcex.lpszMenuName = 0; | 442 wcex.lpszMenuName = 0; |
| 443 wcex.lpszClassName = webkit::npapi::kWrapperNativeWindowClassName; | 443 wcex.lpszClassName = webkit::npapi::kWrapperNativeWindowClassName; |
| 444 wcex.hIconSm = 0; | 444 wcex.hIconSm = 0; |
| 445 window_class = RegisterClassEx(&wcex); | 445 window_class = RegisterClassEx(&wcex); |
| 446 } | 446 } |
| 447 DCHECK(window_class); | 447 DCHECK(window_class); |
| 448 | 448 |
| 449 HWND orig_parent = ::GetParent(window); | |
| 449 HWND parent = CreateWindowEx( | 450 HWND parent = CreateWindowEx( |
| 450 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 451 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
| 451 MAKEINTATOM(window_class), 0, | 452 MAKEINTATOM(window_class), 0, |
| 452 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 453 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
| 453 0, 0, 0, 0, ::GetParent(window), 0, GetModuleHandle(NULL), 0); | 454 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0); |
| 454 ui::CheckWindowCreated(parent); | 455 ui::CheckWindowCreated(parent); |
| 456 // If UIPI is enabled we need to add message filters for parents with | |
| 457 // children that cross process boundaries. | |
| 458 if (::GetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp)) { | |
| 459 typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)( | |
|
cpu_(ooo_6.6-7.5)
2011/08/12 18:13:05
no need to GetProcAddress I think.
jschuh
2011/08/12 19:00:48
Just tested on WinXP and we crash on a failed impo
| |
| 460 HWND hwnd, | |
| 461 UINT message, | |
| 462 DWORD action, | |
| 463 PCHANGEFILTERSTRUCT change_filter_struct); | |
| 464 static ChangeWindowMessageFilterExFunction s_ChangeWindowMessageFilterEx = | |
| 465 reinterpret_cast<ChangeWindowMessageFilterExFunction>( | |
| 466 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), | |
| 467 "ChangeWindowMessageFilterEx")); | |
| 468 // Process-wide message filters required on Vista must be added to: | |
| 469 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | |
| 470 s_ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); | |
| 471 s_ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); | |
| 472 ::SetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp, NULL); | |
| 473 } | |
| 455 ::SetParent(window, parent); | 474 ::SetParent(window, parent); |
| 456 BrowserThread::PostTask( | 475 BrowserThread::PostTask( |
| 457 BrowserThread::IO, FROM_HERE, | 476 BrowserThread::IO, FROM_HERE, |
| 458 new NotifyPluginProcessHostTask(window, parent)); | 477 new NotifyPluginProcessHostTask(window, parent)); |
| 459 return parent; | 478 return parent; |
| 460 } | 479 } |
| 461 | 480 |
| 462 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 481 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
| 463 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); | 482 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); |
| 464 vector->push_back(hwnd); | 483 vector->push_back(hwnd); |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1827 DWORD ex_style) { | 1846 DWORD ex_style) { |
| 1828 parent_hwnd_ = parent_hwnd; | 1847 parent_hwnd_ = parent_hwnd; |
| 1829 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); | 1848 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); |
| 1830 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); | 1849 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); |
| 1831 // To show tooltip on popup window.(e.g. title in <select>) | 1850 // To show tooltip on popup window.(e.g. title in <select>) |
| 1832 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. | 1851 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. |
| 1833 // Ensure the tooltip is created otherwise tooltips are never shown. | 1852 // Ensure the tooltip is created otherwise tooltips are never shown. |
| 1834 EnsureTooltip(); | 1853 EnsureTooltip(); |
| 1835 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); | 1854 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); |
| 1836 } | 1855 } |
| OLD | NEW |