diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 21:01:18 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 21:01:18 +0000 |
commit | 1fd456988642f12f398b05b1bcf05d59ecd86c56 (patch) | |
tree | 94f717ec613cd0d819f1f03052a7e0740c21b234 /chrome_frame | |
parent | 24c0cd67a1b25a26da7e45117990098988c47368 (diff) | |
download | chromium_src-1fd456988642f12f398b05b1bcf05d59ecd86c56.zip chromium_src-1fd456988642f12f398b05b1bcf05d59ecd86c56.tar.gz chromium_src-1fd456988642f12f398b05b1bcf05d59ecd86c56.tar.bz2 |
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
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 2 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_plugin.h | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 26bfa4f..d31b2a8 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -194,7 +194,7 @@ STDMETHODIMP ChromeActiveDocument::IsDirty() { void ChromeActiveDocument::OnAutomationServerReady() { BaseActiveX::OnAutomationServerReady(); - BaseActiveX::GiveFocusToChrome(); + BaseActiveX::GiveFocusToChrome(true); } STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable, 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); } } } |