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

Unified Diff: athena/home/home_card_impl.cc

Issue 305873002: InputManager/AcceleratorManager for athena (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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/home/DEPS ('k') | athena/input/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/home/home_card_impl.cc
diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc
index 13723afb1794e51d0868bd5d677382f29f0a308e..949d5512d4e158be816cb91bb5bd3cff28e85757 100644
--- a/athena/home/home_card_impl.cc
+++ b/athena/home/home_card_impl.cc
@@ -5,6 +5,8 @@
#include "athena/home/public/home_card.h"
#include "athena/home/app_list_view_delegate.h"
+#include "athena/input/public/accelerator_manager.h"
+#include "athena/input/public/input_manager.h"
#include "athena/screen/public/screen_manager.h"
#include "ui/app_list/pagination_model.h"
#include "ui/app_list/views/app_list_view.h"
@@ -68,7 +70,7 @@ class HomeCardLayoutManager : public aura::LayoutManager {
DISALLOW_COPY_AND_ASSIGN(HomeCardLayoutManager);
};
-class HomeCardImpl : public HomeCard {
+class HomeCardImpl : public HomeCard, public AcceleratorHandler {
public:
HomeCardImpl();
virtual ~HomeCardImpl();
@@ -76,6 +78,20 @@ class HomeCardImpl : public HomeCard {
void Init();
private:
+ enum Command {
+ COMMAND_SHOW_HOME_CARD,
+ };
+ void InstallAccelerators();
+
+ // AcceleratorHandler:
+ virtual bool IsCommandEnabled(int command_id) const OVERRIDE { return true; }
+ virtual bool OnAcceleratorFired(int command_id,
+ const ui::Accelerator& accelerator) OVERRIDE {
+ DCHECK_EQ(COMMAND_SHOW_HOME_CARD, command_id);
+ home_card_widget_->Show();
+ return true;
+ }
+
views::Widget* home_card_widget_;
DISALLOW_COPY_AND_ASSIGN(HomeCardImpl);
@@ -94,6 +110,8 @@ HomeCardImpl::~HomeCardImpl() {
}
void HomeCardImpl::Init() {
+ InstallAccelerators();
+
aura::Window* container =
ScreenManager::Get()->CreateContainer("HomeCardContainer");
container->SetLayoutManager(new HomeCardLayoutManager(container));
@@ -111,6 +129,15 @@ void HomeCardImpl::Init() {
view->ShowWhenReady();
}
+void HomeCardImpl::InstallAccelerators() {
+ const AcceleratorData accelerator_data[] = {
+ {TRIGGER_ON_PRESS, ui::VKEY_L, ui::EF_CONTROL_DOWN,
+ COMMAND_SHOW_HOME_CARD, AF_NONE},
+ };
+ InputManager::Get()->GetAcceleratorManager()->RegisterAccelerators(
+ accelerator_data, arraysize(accelerator_data), this);
+}
+
} // namespace
// static
« no previous file with comments | « athena/home/DEPS ('k') | athena/input/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698