diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-06 19:55:13 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-06 19:55:13 +0000 |
commit | d914b773448e8a640f2ab0d69e66d8ec9cc8b55a (patch) | |
tree | 6dcf60a22f2eace881011d34656bdc2b239df8bc /ash | |
parent | 2f4861d246635e5a1ff2ad082c848b7158e8793b (diff) | |
download | chromium_src-d914b773448e8a640f2ab0d69e66d8ec9cc8b55a.zip chromium_src-d914b773448e8a640f2ab0d69e66d8ec9cc8b55a.tar.gz chromium_src-d914b773448e8a640f2ab0d69e66d8ec9cc8b55a.tar.bz2 |
Revert 120587 - Implements accelerator handling for menus on aura.
BUG=105964
TEST=Manual
Review URL: https://chromiumcodereview.appspot.com/9224001
TBR=pkotwicz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9334008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_dispatcher.cc | 15 | ||||
-rw-r--r-- | ash/accelerators/accelerator_dispatcher.h | 37 | ||||
-rw-r--r-- | ash/accelerators/accelerator_dispatcher_linux.cc | 46 | ||||
-rw-r--r-- | ash/accelerators/accelerator_dispatcher_win.cc | 39 | ||||
-rw-r--r-- | ash/accelerators/nested_dispatcher_controller.cc | 28 | ||||
-rw-r--r-- | ash/accelerators/nested_dispatcher_controller.h | 33 | ||||
-rw-r--r-- | ash/ash.gyp | 6 | ||||
-rw-r--r-- | ash/shell.cc | 2 | ||||
-rw-r--r-- | ash/shell.h | 3 |
9 files changed, 0 insertions, 209 deletions
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc deleted file mode 100644 index 46d7bec..0000000 --- a/ash/accelerators/accelerator_dispatcher.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012 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" - -namespace ash { - -AcceleratorDispatcher::AcceleratorDispatcher( - MessageLoop::Dispatcher* nested_dispatcher) - : nested_dispatcher_(nested_dispatcher) { - DCHECK(nested_dispatcher_); -} - -} // namespace ash diff --git a/ash/accelerators/accelerator_dispatcher.h b/ash/accelerators/accelerator_dispatcher.h deleted file mode 100644 index 9de596c..0000000 --- a/ash/accelerators/accelerator_dispatcher.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 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. - -#ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ -#define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ -#pragma once - -#include "ash/ash_export.h" -#include "base/message_loop.h" - -namespace ash { - -// Dispatcher for handling accelerators in ash. -// Wraps a nested dispatcher to which control is passed if no accelerator key -// has been pressed. -// TODO(pkotwicz): Port AcceleratorDispatcher to mac. -class ASH_EXPORT AcceleratorDispatcher : public MessageLoop::Dispatcher { - public: - explicit AcceleratorDispatcher(MessageLoop::Dispatcher* nested_dispatcher); - -#if defined(USE_X11) - virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( - XEvent* xev) OVERRIDE; -#elif defined(OS_WIN) - bool AcceleratorDispatcher::Dispatch(const MSG& msg) OVERRIDE; -#endif - - private: - MessageLoop::Dispatcher* nested_dispatcher_; - - DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher); -}; - -} // namespace ash - -#endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ diff --git a/ash/accelerators/accelerator_dispatcher_linux.cc b/ash/accelerators/accelerator_dispatcher_linux.cc deleted file mode 100644 index 82b98aa..0000000 --- a/ash/accelerators/accelerator_dispatcher_linux.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2012 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 <X11/Xlib.h> - -// Xlib defines RootWindow -#ifdef RootWindow -#undef RootWindow -#endif - -#include "ash/accelerators/accelerator_controller.h" -#include "ash/shell.h" -#include "ui/aura/event.h" -#include "ui/aura/root_window.h" -#include "ui/base/accelerators/accelerator.h" - -namespace ash { - -namespace { - -const int kModifierMask = (ui::EF_SHIFT_DOWN | - ui::EF_CONTROL_DOWN | - ui::EF_ALT_DOWN); -} // namespace - -base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch( - XEvent* xev) { - ash::Shell* shell = ash::Shell::GetInstance(); - if (shell->IsScreenLocked()) - return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev); - - if (xev->type == KeyPress) { - ash::AcceleratorController* accelerator_controller = - shell->accelerator_controller(); - ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), - ui::EventFlagsFromNative(xev) & kModifierMask); - if (accelerator_controller && accelerator_controller->Process(accelerator)) - return EVENT_PROCESSED; - } - return nested_dispatcher_->Dispatch(xev); -} - -} // namespace ash diff --git a/ash/accelerators/accelerator_dispatcher_win.cc b/ash/accelerators/accelerator_dispatcher_win.cc deleted file mode 100644 index 4682275..0000000 --- a/ash/accelerators/accelerator_dispatcher_win.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2012 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/event.h" -#include "ui/aura/root_window.h" -#include "ui/base/accelerators/accelerator.h" - -namespace ash { - -namespace { - -const int kModifierMask = (ui::EF_SHIFT_DOWN | - ui::EF_CONTROL_DOWN | - ui::EF_ALT_DOWN); -} // namespace - -bool AcceleratorDispatcher::Dispatch(const MSG& msg) { - ash::Shell* shell = ash::Shell::GetInstance(); - if (shell->IsScreenLocked()) - return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(msg); - - if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { - ash::AcceleratorController* accelerator_controller = - shell->accelerator_controller(); - ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg), - ui::EventFlagsFromNative(msg) & kModifierMask); - if (accelerator_controller && accelerator_controller->Process(accelerator)) - return true; - } - - return nested_dispatcher_->Dispatch(msg); -} - -} // namespace ash diff --git a/ash/accelerators/nested_dispatcher_controller.cc b/ash/accelerators/nested_dispatcher_controller.cc deleted file mode 100644 index 747a2ce..0000000 --- a/ash/accelerators/nested_dispatcher_controller.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012 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/nested_dispatcher_controller.h" - -#include "ash/accelerators/accelerator_dispatcher.h" - -namespace ash { - -NestedDispatcherController::NestedDispatcherController() { - aura::client::SetDispatcherClient(this); -} - -void NestedDispatcherController::RunWithDispatcher( - MessageLoop::Dispatcher* nested_dispatcher, - bool nestable_tasks_allowed) { - MessageLoopForUI* loop = MessageLoopForUI::current(); - bool did_allow_task_nesting = loop->NestableTasksAllowed(); - loop->SetNestableTasksAllowed(nestable_tasks_allowed); - - AcceleratorDispatcher dispatcher(nested_dispatcher); - - loop->RunWithDispatcher(&dispatcher); - loop->SetNestableTasksAllowed(did_allow_task_nesting); -} - -} // namespace ash diff --git a/ash/accelerators/nested_dispatcher_controller.h b/ash/accelerators/nested_dispatcher_controller.h deleted file mode 100644 index 31822af..0000000 --- a/ash/accelerators/nested_dispatcher_controller.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2012 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. - -#ifndef ASH_ACCELERATORS_NESTED_DISPATCHER_CONTROLLER_H_ -#define ASH_ACCELERATORS_NESTED_DISPATCHER_CONTROLLER_H_ -#pragma once - -#include "ash/ash_export.h" -#include "base/message_loop.h" -#include "ui/aura/client/dispatcher_client.h" - -namespace ash { - -// Creates a dispatcher which wraps another dispatcher. -// The outer dispatcher runs first and performs ash specific handling. -// If it does not consume the event it forwards the event to the nested -// dispatcher. -class ASH_EXPORT NestedDispatcherController - : public aura::client::DispatcherClient { - public: - NestedDispatcherController(); - - virtual void RunWithDispatcher(MessageLoop::Dispatcher* dispatcher, - bool nestable_tasks_allowed) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(NestedDispatcherController); -}; - -} // namespace ash - -#endif // ASH_ACCELERATORS_NESTED_DISPATCHER_CONTROLLER_H_ diff --git a/ash/ash.gyp b/ash/ash.gyp index 720377d..3f00fff 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -36,14 +36,8 @@ # All .cc, .h under ash, except unittests 'accelerators/accelerator_controller.cc', 'accelerators/accelerator_controller.h', - 'accelerators/accelerator_dispatcher.cc', - 'accelerators/accelerator_dispatcher.h', - 'accelerators/accelerator_dispatcher_linux.cc', - 'accelerators/accelerator_dispatcher_win.cc', 'accelerators/accelerator_filter.cc', 'accelerators/accelerator_filter.h', - 'accelerators/nested_dispatcher_controller.cc', - 'accelerators/nested_dispatcher_controller.h', 'app_list/app_list.cc', 'app_list/app_list.h', 'app_list/app_list_groups_view.cc', diff --git a/ash/shell.cc b/ash/shell.cc index 6f506bf..b1203bc 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -8,7 +8,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_filter.h" -#include "ash/accelerators/nested_dispatcher_controller.h" #include "ash/app_list/app_list.h" #include "ash/ash_switches.h" #include "ash/drag_drop/drag_drop_controller.h" @@ -188,7 +187,6 @@ Shell* Shell::instance_ = NULL; Shell::Shell(ShellDelegate* delegate) : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), - nested_dispatcher_controller_(new NestedDispatcherController), accelerator_controller_(new AcceleratorController), delegate_(delegate), window_mode_(MODE_OVERLAPPING), diff --git a/ash/shell.h b/ash/shell.h index 9f20fc4..16add64 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -37,7 +37,6 @@ namespace ash { class AcceleratorController; class Launcher; -class NestedDispatcherController; class PowerButtonController; class ShellDelegate; class VideoDetector; @@ -172,8 +171,6 @@ class ASH_EXPORT Shell { base::WeakPtrFactory<Shell> method_factory_; - scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; - scoped_ptr<AcceleratorController> accelerator_controller_; scoped_ptr<ShellDelegate> delegate_; |