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 // Process-wide message filters required on Vista must be added to: | |
460 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | |
461 typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)( | |
462 HWND hwnd, | |
463 UINT message, | |
464 DWORD action, | |
465 PCHANGEFILTERSTRUCT change_filter_struct); | |
466 static ChangeWindowMessageFilterExFunction s_ChangeWindowMessageFilterEx = | |
M-A Ruel
2011/08/12 23:50:05
Say No! to local static variables! In incurs a glo
| |
467 reinterpret_cast<ChangeWindowMessageFilterExFunction>( | |
468 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), | |
469 "ChangeWindowMessageFilterEx")); | |
470 // Process-wide message filters required on Vista must be added to: | |
471 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | |
472 s_ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); | |
473 s_ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); | |
474 ::SetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp, NULL); | |
475 } | |
455 ::SetParent(window, parent); | 476 ::SetParent(window, parent); |
456 BrowserThread::PostTask( | 477 BrowserThread::PostTask( |
457 BrowserThread::IO, FROM_HERE, | 478 BrowserThread::IO, FROM_HERE, |
458 new NotifyPluginProcessHostTask(window, parent)); | 479 new NotifyPluginProcessHostTask(window, parent)); |
459 return parent; | 480 return parent; |
460 } | 481 } |
461 | 482 |
462 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 483 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
463 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); | 484 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); |
464 vector->push_back(hwnd); | 485 vector->push_back(hwnd); |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1827 DWORD ex_style) { | 1848 DWORD ex_style) { |
1828 parent_hwnd_ = parent_hwnd; | 1849 parent_hwnd_ = parent_hwnd; |
1829 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); | 1850 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); |
1830 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); | 1851 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); |
1831 // To show tooltip on popup window.(e.g. title in <select>) | 1852 // To show tooltip on popup window.(e.g. title in <select>) |
1832 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. | 1853 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. |
1833 // Ensure the tooltip is created otherwise tooltips are never shown. | 1854 // Ensure the tooltip is created otherwise tooltips are never shown. |
1834 EnsureTooltip(); | 1855 EnsureTooltip(); |
1835 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); | 1856 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); |
1836 } | 1857 } |
OLD | NEW |