| 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); | |
| 450 HWND parent = CreateWindowEx( | 449 HWND parent = CreateWindowEx( |
| 451 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 450 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
| 452 MAKEINTATOM(window_class), 0, | 451 MAKEINTATOM(window_class), 0, |
| 453 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 452 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
| 454 0, 0, 0, 0, orig_parent, 0, GetModuleHandle(NULL), 0); | 453 0, 0, 0, 0, ::GetParent(window), 0, GetModuleHandle(NULL), 0); |
| 455 ui::CheckWindowCreated(parent); | 454 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 = | |
| 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 } | |
| 476 ::SetParent(window, parent); | 455 ::SetParent(window, parent); |
| 477 BrowserThread::PostTask( | 456 BrowserThread::PostTask( |
| 478 BrowserThread::IO, FROM_HERE, | 457 BrowserThread::IO, FROM_HERE, |
| 479 new NotifyPluginProcessHostTask(window, parent)); | 458 new NotifyPluginProcessHostTask(window, parent)); |
| 480 return parent; | 459 return parent; |
| 481 } | 460 } |
| 482 | 461 |
| 483 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 462 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
| 484 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); | 463 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); |
| 485 vector->push_back(hwnd); | 464 vector->push_back(hwnd); |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 DWORD ex_style) { | 1827 DWORD ex_style) { |
| 1849 parent_hwnd_ = parent_hwnd; | 1828 parent_hwnd_ = parent_hwnd; |
| 1850 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); | 1829 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); |
| 1851 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); | 1830 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); |
| 1852 // To show tooltip on popup window.(e.g. title in <select>) | 1831 // To show tooltip on popup window.(e.g. title in <select>) |
| 1853 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. | 1832 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. |
| 1854 // Ensure the tooltip is created otherwise tooltips are never shown. | 1833 // Ensure the tooltip is created otherwise tooltips are never shown. |
| 1855 EnsureTooltip(); | 1834 EnsureTooltip(); |
| 1856 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); | 1835 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); |
| 1857 } | 1836 } |
| OLD | NEW |