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

Unified Diff: athena/main/athena_main.cc

Issue 356263003: Move HomeCard to avoid virtual keyboard when it's shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/main/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « athena/main/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698