Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_view.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc |
| index 716b33b420ac2a73b7884bad07fd707ac63fd716..3c7e8ef17232db7755f27faddcff92fea4818510 100644 |
| --- a/chrome/browser/ui/views/frame/browser_view.cc |
| +++ b/chrome/browser/ui/views/frame/browser_view.cc |
| @@ -1215,6 +1215,17 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| NativeWebKeyboardEvent::ControlKey, |
| (event.modifiers & NativeWebKeyboardEvent::AltKey) == |
| NativeWebKeyboardEvent::AltKey); |
| + if (event.type == WebKit::WebInputEvent::KeyUp) |
| + accelerator.set_type(ui::ET_KEY_RELEASED); |
| + |
| + // If the current target of the |accelerator| is not |this| object, and the |
| + // browser is not for an app, the |accelerator| will be processed immediately. |
| + const ui::AcceleratorTarget* target = |
| + focus_manager->GetCurrentTargetForAccelerator(accelerator); |
| + if (!browser_->is_app() && target && target != this) { |
| + focus_manager->ProcessAccelerator(accelerator); |
| + return true; |
| + } |
| // We first find out the browser command associated to the |event|. |
| // Then if the command is a reserved one, and should be processed |
| @@ -1223,7 +1234,8 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| // return false. |
| // This piece of code is based on the fact that accelerators registered |
| - // into the |focus_manager| may only trigger a browser command execution. |
| + // into the |focus_manager| may only trigger a browser command execution if |
| + // the current target of the |accelerator| is |this| object. |
| // |
| // Here we need to retrieve the command id (if any) associated to the |
| // keyboard event. Instead of looking up the command id in the |
| @@ -1232,7 +1244,8 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| // |focus_manager| as if we are activating an accelerator key. |
| // Then we can retrieve the command id from the |browser_| object. |
| browser_->SetBlockCommandExecution(true); |
| - focus_manager->ProcessAccelerator(accelerator); |
| + if (target == this) |
|
Ben Goodger (Google)
2012/05/04 16:25:33
not sure if I understand the target checking. was
Yusuke Sato
2012/05/07 08:27:28
Done.
On 2012/05/04 16:25:33, Ben Goodger (Google
|
| + focus_manager->ProcessAccelerator(accelerator); |
| int id = browser_->GetLastBlockedCommand(NULL); |
| browser_->SetBlockCommandExecution(false); |