Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2078)

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 10134036: Let Chrome app handle Ash accelerators first if the app is launched as a window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698