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

Unified Diff: ash/accelerators/accelerator_filter.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: final rebase Created 8 years, 7 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: ash/accelerators/accelerator_filter.cc
diff --git a/ash/accelerators/accelerator_filter.cc b/ash/accelerators/accelerator_filter.cc
index dcc95ba9bd9c037f56383601b29a4ffb724b0278..bcecdfe2b1e80d6feb5b10d7ad326cc49d2de418 100644
--- a/ash/accelerators/accelerator_filter.cc
+++ b/ash/accelerators/accelerator_filter.cc
@@ -12,9 +12,22 @@
#include "ui/base/accelerators/accelerator_manager.h"
namespace {
+
const int kModifierFlagMask = (ui::EF_SHIFT_DOWN |
ui::EF_CONTROL_DOWN |
ui::EF_ALT_DOWN);
+
+// Returns true if an Ash accelerator should be processed now.
+bool ShouldProcessAcceleratorsNow(aura::Window* target) {
+ if (!target)
+ return true;
+ if (target == ash::Shell::GetInstance()->GetRootWindow())
+ return true;
+ // Unless |target| is the root window, return false to let the custom focus
+ // manager (see ash/shell.cc) handle Ash accelerators.
+ return false;
+}
+
} // namespace
namespace ash {
@@ -39,6 +52,8 @@ bool AcceleratorFilter::PreHandleKeyEvent(aura::Window* target,
return false;
if (event->is_char())
return false;
+ if (!ShouldProcessAcceleratorsNow(target))
+ return false;
ui::Accelerator accelerator(event->key_code(),
event->flags() & kModifierFlagMask);
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/accelerators/accelerator_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698