| Index: athena/home/home_card_impl.cc
|
| diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc
|
| index 2f1dd8ccd463f36b72df4101dfb163b3a0d1fca6..43c6ad005a4426c61ef055115b9d1d1d2be9f216 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/home_card_delegate_view.h"
|
| +#include "athena/input/public/accelerator_manager.h"
|
| +#include "athena/input/public/input_manager.h"
|
| #include "athena/screen/public/screen_manager.h"
|
| #include "ui/aura/layout_manager.h"
|
| #include "ui/aura/window.h"
|
| @@ -62,7 +64,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();
|
| @@ -70,6 +72,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);
|
| @@ -87,6 +103,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() {
|
| home_card_widget_->Show();
|
| }
|
|
|
| +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
|
|
|