Index: athena/wm/window_manager_impl.cc |
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
index 589da390733ec1ecf3999c24c0b16278b8b5d35c..704c457b45af68d36bd70045903e4cbbe55aa47c 100644 |
--- a/athena/wm/window_manager_impl.cc |
+++ b/athena/wm/window_manager_impl.cc |
@@ -4,6 +4,7 @@ |
#include "athena/wm/public/window_manager.h" |
+#include "athena/input/public/accelerator_manager.h" |
#include "athena/screen/public/screen_manager.h" |
#include "athena/wm/window_overview_mode.h" |
#include "base/logging.h" |
@@ -16,13 +17,19 @@ namespace { |
class WindowManagerImpl : public WindowManager, |
public WindowOverviewModeDelegate, |
- public aura::WindowObserver { |
+ public aura::WindowObserver, |
+ public AcceleratorHandler { |
public: |
WindowManagerImpl(); |
virtual ~WindowManagerImpl(); |
+ void Init() { |
+ InstallAccelerators(); |
+ } |
+ |
void Layout(); |
+ |
sadrul
2014/07/15 04:41:38
remove this extra blank line.
oshima
2014/07/15 19:36:18
Done.
|
// WindowManager: |
virtual void ToggleOverview() OVERRIDE { |
if (overview_) |
@@ -32,6 +39,19 @@ class WindowManagerImpl : public WindowManager, |
} |
private: |
+ enum Command { |
+ COMMAND_TOGGLE_OVERVIEW, |
+ }; |
+ |
+ void InstallAccelerators() { |
+ const AcceleratorData accelerator_data[] = { |
+ {TRIGGER_ON_PRESS, ui::VKEY_6, ui::EF_NONE, |
+ COMMAND_TOGGLE_OVERVIEW, AF_NONE}, |
+ }; |
+ AcceleratorManager::Get()->RegisterAccelerators( |
+ accelerator_data, arraysize(accelerator_data), this); |
+ } |
+ |
// WindowOverviewModeDelegate: |
virtual void OnSelectWindow(aura::Window* window) OVERRIDE { |
CHECK_EQ(container_.get(), window->parent()); |
@@ -45,6 +65,18 @@ class WindowManagerImpl : public WindowManager, |
container_.reset(); |
} |
+ // AcceleratorHandler: |
+ virtual bool IsCommandEnabled(int command_id) const OVERRIDE { return true; } |
+ virtual bool OnAcceleratorFired(int command_id, |
+ const ui::Accelerator& accelerator) OVERRIDE { |
+ switch (command_id) { |
+ case COMMAND_TOGGLE_OVERVIEW: |
+ ToggleOverview(); |
+ break; |
+ } |
+ return true; |
+ } |
+ |
scoped_ptr<aura::Window> container_; |
scoped_ptr<ui::EventHandler> temp_handler_; |
scoped_ptr<WindowOverviewMode> overview_; |