diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 00:00:59 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 00:00:59 +0000 |
commit | 2b8fd32897bb674a71f09fd3ec91675b9a627181 (patch) | |
tree | f35be1cd41fcaef337f7b019433324889a9209f7 /chrome_frame | |
parent | 750b7affd8971908b2d89712a0ec815bcc3e0537 (diff) | |
download | chromium_src-2b8fd32897bb674a71f09fd3ec91675b9a627181.zip chromium_src-2b8fd32897bb674a71f09fd3ec91675b9a627181.tar.gz chromium_src-2b8fd32897bb674a71f09fd3ec91675b9a627181.tar.bz2 |
Fixes the following issue
Ensures Alt and Alt + character keys work correctly in
ChromeFrame. There were two issues here:-
a. Chrome would not forward unhandled Keyup messages. For
the curious this carries WM_SYSKEYUP which is needed
for Alt key to work.
b. WM_SYSCHAR is not handled by the TranslateAccelerator
function in IOleControlSite and
IBrowserService2::v_MayTranslateAccelerator
MSHTML does the same thing and also dispatches the
message. We need to understand this better. For now
we just post the message back to our parent which
works.
This fixes http://code.google.com/p/chromium/issues/detail?id=22996
Bug=22996
Review URL: http://codereview.chromium.org/257019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 8 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 28 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex.h | 1 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex_base.h | 44 |
4 files changed, 47 insertions, 34 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index ad104c9..dfb1b03 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -399,12 +399,8 @@ void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle, if (IsFindAccelerator(accel_message)) { // Handle the showing of the find dialog explicitly. OnFindInPage(); - } else if (AllowFrameToTranslateAccelerator(accel_message) != S_OK) { - DLOG(INFO) << "IE DID NOT handle accel key " << accel_message.wParam; - TabProxy* tab = GetTabProxy(); - if (tab) { - tab->ProcessUnhandledAccelerator(accel_message); - } + } else { + Base::OnAcceleratorPressed(tab_handle, accel_message); } } else { DLOG(INFO) << "IE handled accel key " << accel_message.wParam; diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index e58a961..9999fb7 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -51,32 +51,6 @@ LRESULT ChromeFrameActivex::OnCreate(UINT message, WPARAM wparam, LPARAM lparam, return 0; } -void ChromeFrameActivex::OnAcceleratorPressed(int tab_handle, - const MSG& accel_message) { - DCHECK(m_spInPlaceSite != NULL); - // Allow our host a chance to handle the accelerator. - // This catches things like Ctrl+F, Ctrl+O etc, but not browser - // accelerators such as F11, Ctrl+T etc. - // (see AllowFrameToTranslateAccelerator for those). - HRESULT hr = TranslateAccelerator(const_cast<MSG*>(&accel_message)); - if (hr != S_OK) - hr = AllowFrameToTranslateAccelerator(accel_message); - - DLOG(INFO) << __FUNCTION__ << " browser response: " - << StringPrintf("0x%08x", hr); - - // Last chance to handle the keystroke is to pass it to chromium. - // We do this last partially because there's no way for us to tell if - // chromium actually handled the keystroke, but also since the browser - // should have first dibs anyway. - if (hr != S_OK && automation_client_.get()) { - TabProxy* tab = automation_client_->tab(); - if (tab) { - tab->ProcessUnhandledAccelerator(accel_message); - } - } -} - HRESULT ChromeFrameActivex::GetContainingDocument(IHTMLDocument2** doc) { ScopedComPtr<IOleContainer> container; HRESULT hr = m_spClientSite->GetContainer(container.Receive()); @@ -280,7 +254,7 @@ STDMETHODIMP ChromeFrameActivex::Load(IPropertyBag* bag, IErrorLog* error_log) { const wchar_t g_activex_mixed_content_error[] = { L"data:text/html,<html><body><b>ChromeFrame Security Error<br><br>" L"Cannot navigate to HTTP url when document URL is HTTPS</body></html>"}; - + STDMETHODIMP ChromeFrameActivex::put_src(BSTR src) { GURL document_url(GetDocumentUrl()); if (document_url.SchemeIsSecure()) { diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h index 07b8122..d60b14b 100644 --- a/chrome_frame/chrome_frame_activex.h +++ b/chrome_frame/chrome_frame_activex.h @@ -80,7 +80,6 @@ END_MSG_MAP() STDMETHOD(put_src)(BSTR src); protected: - virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message); virtual void OnLoad(int tab_handle, const GURL& url); virtual void OnMessageFromChromeFrame(int tab_handle, const std::string& message, diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index 7754bc0..70366d1 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -821,6 +821,50 @@ END_MSG_MAP() return hr; } + virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) { + DCHECK(m_spInPlaceSite != NULL); + // Allow our host a chance to handle the accelerator. + // This catches things like Ctrl+F, Ctrl+O etc, but not browser + // accelerators such as F11, Ctrl+T etc. + // (see AllowFrameToTranslateAccelerator for those). + HRESULT hr = TranslateAccelerator(const_cast<MSG*>(&accel_message)); + if (hr != S_OK) + hr = AllowFrameToTranslateAccelerator(accel_message); + + DLOG(INFO) << __FUNCTION__ << " browser response: " + << StringPrintf("0x%08x", hr); + + if (hr != S_OK) { + // The WM_SYSCHAR message is not processed by the IOleControlSite + // implementation and the IBrowserService2::v_MayTranslateAccelerator + // implementation. We need to understand this better. That is for + // another day. For now we just post the WM_SYSCHAR message back to our + // parent which forwards it off to the frame. This should not cause major + // grief for Chrome as it does not need to handle WM_SYSCHAR accelerators + // when running in ChromeFrame mode. + // TODO(iyengar) + // Understand and fix WM_SYSCHAR handling + // We should probably unify the accelerator handling for the active + // document and the activex. + if (accel_message.message == WM_SYSCHAR) { + ::PostMessage(GetParent(), WM_SYSCHAR, accel_message.wParam, + accel_message.lParam); + return; + } + } + + // Last chance to handle the keystroke is to pass it to chromium. + // We do this last partially because there's no way for us to tell if + // chromium actually handled the keystroke, but also since the browser + // should have first dibs anyway. + if (hr != S_OK && automation_client_.get()) { + TabProxy* tab = automation_client_->tab(); + if (tab) { + tab->ProcessUnhandledAccelerator(accel_message); + } + } + } + protected: ScopedBstr url_; ScopedComPtr<IOleDocumentSite> doc_site_; |