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

Unified Diff: ash/accelerators/accelerator_dispatcher.cc

Issue 298703007: Refactor and move ash independent nested accelerator code to ui/wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip test if platform does not support PES Created 6 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
« no previous file with comments | « ash/accelerators/accelerator_dispatcher.h ('k') | ash/accelerators/accelerator_dispatcher_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_dispatcher.cc
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc
deleted file mode 100644
index c484101879f6b83efa336021ceb632b14cdf03c0..0000000000000000000000000000000000000000
--- a/ash/accelerators/accelerator_dispatcher.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/accelerators/accelerator_dispatcher.h"
-
-#include "ash/accelerators/accelerator_controller.h"
-#include "ash/shell.h"
-#include "ui/aura/window_event_dispatcher.h"
-#include "ui/base/accelerators/accelerator.h"
-#include "ui/events/event.h"
-#include "ui/events/event_constants.h"
-#include "ui/events/event_utils.h"
-#include "ui/views/controls/menu/menu_controller.h"
-
-namespace ash {
-namespace {
-
-bool IsPossibleAcceleratorNotForMenu(const ui::KeyEvent& key_event) {
- // For shortcuts generated by Ctrl or Alt plus a letter, number or
- // the tab key, we want to exit the context menu first and then
- // repost the event. That allows for the shortcut execution after
- // the context menu has exited.
- if (key_event.type() == ui::ET_KEY_PRESSED &&
- (key_event.flags() & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN))) {
- const ui::KeyboardCode key_code = key_event.key_code();
- if ((key_code >= ui::VKEY_A && key_code <= ui::VKEY_Z) ||
- (key_code >= ui::VKEY_0 && key_code <= ui::VKEY_9) ||
- (key_code == ui::VKEY_TAB)) {
- return true;
- }
- }
- return false;
-}
-
-} // namespace
-
-bool AcceleratorDispatcher::MenuClosedForPossibleAccelerator(
- const ui::KeyEvent& key_event) {
- if (!IsPossibleAcceleratorNotForMenu(key_event))
- return false;
-
- if (views::MenuController* menu_controller =
- views::MenuController::GetActiveInstance()) {
- menu_controller->CancelAll();
- return true;
- }
- return false;
-}
-
-bool AcceleratorDispatcher::AcceleratorProcessedForKeyEvent(
- const ui::KeyEvent& key_event) {
- ash::AcceleratorController* accelerator_controller =
- ash::Shell::GetInstance()->accelerator_controller();
- if (!accelerator_controller)
- return false;
- const int kModifierMask =
- (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN);
- ui::Accelerator accelerator(key_event.key_code(),
- key_event.flags() & kModifierMask);
- if (key_event.type() == ui::ET_KEY_RELEASED)
- accelerator.set_type(ui::ET_KEY_RELEASED);
- // Fill out context object so AcceleratorController will know what
- // was the previous accelerator or if the current accelerator is repeated.
- Shell::GetInstance()->accelerator_controller()->context()->UpdateContext(
- accelerator);
- return accelerator_controller->Process(accelerator);
-}
-
-} // namespace ash
« no previous file with comments | « ash/accelerators/accelerator_dispatcher.h ('k') | ash/accelerators/accelerator_dispatcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698