diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 08:21:35 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 08:21:35 +0000 |
commit | a15d4a42a5b5e1fc2390c45188c4d8fa3c381a3f (patch) | |
tree | b051c7d0daf57be61d3f226437d0775df84cb21f /chrome_frame/chrome_active_document.cc | |
parent | 2e59325fed2416cd23d0b418cd46e302148aa584 (diff) | |
download | chromium_src-a15d4a42a5b5e1fc2390c45188c4d8fa3c381a3f.zip chromium_src-a15d4a42a5b5e1fc2390c45188c4d8fa3c381a3f.tar.gz chromium_src-a15d4a42a5b5e1fc2390c45188c4d8fa3c381a3f.tar.bz2 |
We need to support the following accelerators in the ChromeFrame Active document, to ensure that the following
accelerators navigate backwards and forwards in IE history.
1. VK_BACK and Alt + VK_LEFT to navigate back.
2. Shift + VK_BACK and Alt + VK_RIGHT to navigate forward.
This CL adds support for this. We load the accelerator table in our Active document and when we receive an
accelerator from Chrome, we first call the Windows API TranslateAccelerator to translate any accelerators
and then continue with the default handling. Added handlers for navigating back and forward.
Test=covered by unit test.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=35629
Bug=35629
Review URL: http://codereview.chromium.org/600117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.cc')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index e212b9c..886c9df 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -52,7 +52,8 @@ bool g_first_launch_by_process_ = true; ChromeActiveDocument::ChromeActiveDocument() : first_navigation_(true), - is_automation_client_reused_(false) { + is_automation_client_reused_(false), + accelerator_table_(NULL) { url_fetcher_.set_frame_busting(false); memset(&navigation_info_, 0, sizeof(navigation_info_)); } @@ -95,6 +96,11 @@ HRESULT ChromeActiveDocument::FinalConstruct() { enabled_commands_map_[OLECMDID_PASTE] = true; enabled_commands_map_[OLECMDID_SELECTALL] = true; enabled_commands_map_[OLECMDID_SAVEAS] = true; + + accelerator_table_ = + LoadAccelerators(GetModuleHandle(L"npchrome_frame.dll"), + MAKEINTRESOURCE(IDR_CHROME_FRAME_IE_FULL_TAB)); + DCHECK(accelerator_table_ != NULL); return S_OK; } @@ -487,6 +493,10 @@ bool IsFindAccelerator(const MSG& msg) { void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle, const MSG& accel_message) { + if (::TranslateAccelerator(m_hWnd, accelerator_table_, + const_cast<MSG*>(&accel_message))) + return; + bool handled_accel = false; if (in_place_frame_ != NULL) { handled_accel = (S_OK == in_place_frame_->TranslateAcceleratorW( @@ -978,3 +988,30 @@ HRESULT ChromeActiveDocument::GetBrowserServiceAndTravelLog( return hr; } + +LRESULT ChromeActiveDocument::OnForward(WORD notify_code, WORD id, + HWND control_window, + BOOL& bHandled) { + ScopedComPtr<IWebBrowser2> web_browser2; + DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive()); + DCHECK(web_browser2); + + if (web_browser2) { + web_browser2->GoForward(); + } + return 0; +} + +LRESULT ChromeActiveDocument::OnBack(WORD notify_code, WORD id, + HWND control_window, + BOOL& bHandled) { + ScopedComPtr<IWebBrowser2> web_browser2; + DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive()); + DCHECK(web_browser2); + + if (web_browser2) { + web_browser2->GoBack(); + } + return 0; +} + |