Commit 9c51203f authored by jschuh@chromium.org's avatar jschuh@chromium.org

Prevent Flash from dropping focus on fullscreen change

This is basically a revert of half of this CL:
https://chromiumcodereview.appspot.com/10779023/

BUG=140366
TBR=viettrungluu@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10830187

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150162 0039d316-1c4b-4281-b951-d872f2087c98
parent 8f27a1c8
......@@ -678,6 +678,7 @@ void RenderWidgetHostViewWin::InitAsChild(
void RenderWidgetHostViewWin::InitAsPopup(
RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
close_on_deactivate_ = true;
DoPopupOrFullscreenInit(parent_host_view->GetNativeView(), pos,
WS_EX_TOOLWINDOW);
}
......@@ -1634,7 +1635,8 @@ void RenderWidgetHostViewWin::OnCancelMode() {
if (render_widget_host_)
render_widget_host_->LostCapture();
if (close_on_deactivate_ && !weak_factory_.HasWeakPtrs()) {
if ((is_fullscreen_ || close_on_deactivate_) &&
!weak_factory_.HasWeakPtrs()) {
// Dismiss popups and menus. We do this asynchronously to avoid changing
// activation within this callstack, which may interfere with another window
// being activated. We can synchronously hide the window, but we need to
......@@ -1904,7 +1906,7 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
// RenderViewHostHWND as there is no way to retrieve it from the HWND.
// Don't forward if the container is a popup or fullscreen widget.
if (!close_on_deactivate_) {
if (!is_fullscreen_ && !close_on_deactivate_) {
switch (message) {
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
......@@ -1959,7 +1961,7 @@ LRESULT RenderWidgetHostViewWin::OnKeyEvent(UINT message, WPARAM wparam,
// parent.
// TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the
// FocusManager.
if (close_on_deactivate_ && !is_fullscreen_ &&
if (close_on_deactivate_ &&
(((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) ||
(message == WM_CHAR && wparam == L'\t'))) {
// First close the pop-up.
......@@ -2968,7 +2970,6 @@ void RenderWidgetHostViewWin::ShutdownHost() {
void RenderWidgetHostViewWin::DoPopupOrFullscreenInit(HWND parent_hwnd,
const gfx::Rect& pos,
DWORD ex_style) {
close_on_deactivate_ = true;
Create(parent_hwnd, NULL, NULL, WS_POPUP, ex_style);
MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE);
ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA);
......
......@@ -452,8 +452,7 @@ class RenderWidgetHostViewWin
bool about_to_validate_and_paint_;
// true if the View should be closed when its HWND is deactivated (used to
// support SELECT popups and fullscreen widgets which are closed when they are
// deactivated).
// support SELECT popups which are closed when they are deactivated).
bool close_on_deactivate_;
// Whether Destroy() has been called. Used to detect a crasher
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment