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

Unified Diff: athena/wm/window_manager_impl.cc

Issue 394683002: Use accelerator to switch overview mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « athena/wm/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « athena/wm/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698