Chromium Code Reviews| Index: athena/main/athena_main.cc |
| diff --git a/athena/main/athena_main.cc b/athena/main/athena_main.cc |
| index 906cf3d9cce786933a9759f42051232dd89fc6ed..d43e21fd93dd07f7b435598359b8c4be09e982d3 100644 |
| --- a/athena/main/athena_main.cc |
| +++ b/athena/main/athena_main.cc |
| @@ -24,6 +24,8 @@ |
| #include "content/public/app/content_main.h" |
| #include "ui/aura/window_tree_host.h" |
| #include "ui/base/resource/resource_bundle.h" |
| +#include "ui/keyboard/keyboard_controller.h" |
| +#include "ui/keyboard/keyboard_controller_observer.h" |
| #include "ui/wm/core/visibility_controller.h" |
| namespace { |
| @@ -34,6 +36,24 @@ const char kDefaultAppPath[] = |
| "chrome/common/extensions/docs/examples/apps/calculator/app"; |
| } // namespace |
| +// This class observes the change of the virtual keyboard and distribute the |
| +// change to appropriate modules of athena. |
|
oshima
2014/07/08 18:31:29
can you add
// TODO(oshima): move the VK bounds l
Jun Mukai
2014/07/08 22:25:40
Done.
|
| +class VirtualKeyboardObserver : public keyboard::KeyboardControllerObserver { |
| + public: |
| + VirtualKeyboardObserver() { |
| + keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| + } |
| + |
| + virtual ~VirtualKeyboardObserver() { |
| + keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
| + } |
| + |
| + private: |
| + virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) OVERRIDE { |
| + athena::HomeCard::Get()->UpdateVirtualKeyboardBounds(new_bounds); |
| + } |
|
oshima
2014/07/08 18:31:29
DISALLOW_COPY_AND_ASSIGN
Jun Mukai
2014/07/08 22:25:40
Done.
|
| +}; |
| + |
| class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { |
| public: |
| AthenaBrowserMainDelegate() {} |
| @@ -62,12 +82,16 @@ class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { |
| athena::HomeCard::Get()->RegisterSearchProvider( |
| new athena::UrlSearchProvider(context)); |
| athena::VirtualKeyboardManager::Create(context); |
| + keyboard_observer_.reset(new VirtualKeyboardObserver()); |
| CreateTestPages(context); |
| CreateDebugWindow(); |
| } |
| - virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); } |
| + virtual void Shutdown() OVERRIDE { |
| + keyboard_observer_.reset(); |
| + athena::ShutdownAthena(); |
| + } |
| virtual apps::ShellDesktopController* CreateDesktopController() OVERRIDE { |
| // TODO(mukai): create Athena's own ShellDesktopController subclass so that |
| @@ -78,6 +102,8 @@ class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { |
| } |
| private: |
| + scoped_ptr<VirtualKeyboardObserver> keyboard_observer_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
| }; |