From 1fd456988642f12f398b05b1bcf05d59ecd86c56 Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Mon, 19 Apr 2010 21:01:18 +0000 Subject: Context menu operations like Cut/Copy/Paste etc would not work in pages rendered by ChromeFrame. The context menu is displayed by the ChromeFrame plugin which grabs focus to ensure that the menu has focus, and then restores focus back once we select an item. The latter step sends over a notification to Chrome via an automation message which then informs the view. This resets the webview item selection which results in this bug. Fix is to send over an additional flag to Chrome in the SetInitialFocus which indicates whether we need to inform the view about the focus change or not. Fixes bug http://code.google.com/p/chromium/issues/detail?id=41523 Bug=41523 Review URL: http://codereview.chromium.org/1574033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44951 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/chrome_frame_plugin.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'chrome_frame/chrome_frame_plugin.h') diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h index c7b0598..85d83dc 100644 --- a/chrome_frame/chrome_frame_plugin.h +++ b/chrome_frame/chrome_frame_plugin.h @@ -142,7 +142,7 @@ END_MSG_MAP() UINT selected = TrackPopupMenuEx(copy, flags, params.screen_x, params.screen_y, GetWindow(), NULL); // Menu is over now give focus back to chrome - GiveFocusToChrome(); + GiveFocusToChrome(false); if (IsValid() && selected != 0 && !self->HandleContextMenuCommand(selected, params)) { automation_client_->SendContextMenuCommandToChromeFrame(selected); @@ -155,7 +155,7 @@ END_MSG_MAP() LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // NO_LINT if (!ignore_setfocus_ && IsValid()) { - GiveFocusToChrome(); + GiveFocusToChrome(true); } return 0; } @@ -215,13 +215,14 @@ END_MSG_MAP() return new ChromeFrameAutomationClient; } - void GiveFocusToChrome() { + void GiveFocusToChrome(bool restore_focus_to_view) { if (IsValid()) { TabProxy* tab = automation_client_->tab(); HWND chrome_window = automation_client_->tab_window(); if (tab && ::IsWindow(chrome_window)) { DLOG(INFO) << "Setting initial focus"; - tab->SetInitialFocus(win_util::IsShiftPressed()); + tab->SetInitialFocus(win_util::IsShiftPressed(), + restore_focus_to_view); } } } -- cgit v1.1