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

Unified Diff: ui/keyboard/keyboard_controller.cc

Issue 97013002: [Input View] Makes the input view window support window.resizeTo() and w3c visibility API its web c… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | ui/keyboard/keyboard_controller_proxy.h » ('j') | ui/keyboard/keyboard_controller_proxy.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller.cc
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 0cb975f7d949ebb54311960524adc2f8317e3918..4f57723a5737f50312a89888cd98271952fcc061 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -90,13 +90,25 @@ namespace keyboard {
// LayoutManager for the virtual keyboard container. Manages a single window
// (the virtual keyboard) and keeps it positioned at the bottom of the
// owner window.
-class KeyboardLayoutManager : public aura::LayoutManager {
+class KeyboardLayoutManager : public aura::LayoutManager,
+ public KeyboardResizer {
public:
KeyboardLayoutManager(aura::Window* container)
- : container_(container), keyboard_(NULL) {
+ : container_(container), keyboard_(NULL), resizing_(false) {
CHECK(container_);
}
+ // Overridden from KeyboardResizer
+ virtual void SetKeyboardHeight(int height) {
+ gfx::Rect rect = keyboard_->bounds();
+ int old_height = rect.height();
+ rect.set_height(height);
+ rect.set_y(rect.y() + old_height - height);
+ resizing_ = true;
+ keyboard_->SetBounds(rect);
+ resizing_ = false;
+ }
+
// Overridden from aura::LayoutManager
virtual void OnWindowResized() OVERRIDE {
if (!keyboard_)
@@ -114,12 +126,15 @@ class KeyboardLayoutManager : public aura::LayoutManager {
bool visible) OVERRIDE {}
virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE {
- // Drop these: the size should only be set in OnWindowResized.
+ if (resizing_) {
+ SetChildBoundsDirect(child, requested_bounds);
+ }
}
private:
aura::Window* container_;
aura::Window* keyboard_;
+ bool resizing_;
DISALLOW_COPY_AND_ASSIGN(KeyboardLayoutManager);
};
@@ -148,7 +163,10 @@ aura::Window* KeyboardController::GetContainerWindow() {
container_->set_owned_by_parent(false);
container_->Init(ui::LAYER_NOT_DRAWN);
container_->AddObserver(this);
- container_->SetLayoutManager(new KeyboardLayoutManager(container_.get()));
+ KeyboardLayoutManager* layout_manager = new KeyboardLayoutManager(
+ container_.get());
+ proxy_->SetKeyboardResizer(layout_manager);
+ container_->SetLayoutManager(layout_manager);
kevers 2013/11/29 20:26:05 It looks a bit odd passing a raw pointer to 2 sepa
Shu Chen 2013/12/02 03:54:40 Done. I've refactored the changes and removed the
}
return container_.get();
}
« no previous file with comments | « no previous file | ui/keyboard/keyboard_controller_proxy.h » ('j') | ui/keyboard/keyboard_controller_proxy.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698