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

Unified Diff: ash/wm/virtual_keyboard_container_layout_manager.cc

Issue 617553002: Fix size and position of the virtual keyboard after a screen rotation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: ash/wm/virtual_keyboard_container_layout_manager.cc
diff --git a/ash/wm/virtual_keyboard_container_layout_manager.cc b/ash/wm/virtual_keyboard_container_layout_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff06f5f0cff4c27f85a5214a4223ebf0c7ddbaba
--- /dev/null
+++ b/ash/wm/virtual_keyboard_container_layout_manager.cc
@@ -0,0 +1,44 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/virtual_keyboard_container_layout_manager.h"
+
+#include "ash/shell_window_ids.h"
+#include "ui/aura/window.h"
+#include "ui/keyboard/keyboard_controller.h"
+
+namespace ash {
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualKeyboardContainerLayoutManager, public:
+
+VirtualKeyboardContainerLayoutManager::VirtualKeyboardContainerLayoutManager(
+ aura::Window* container)
+ : SnapToPixelLayoutManager(container),
+ parent_container_(container) {}
+
+VirtualKeyboardContainerLayoutManager::~VirtualKeyboardContainerLayoutManager()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualKeyboardContainerLayoutManager, aura::LayoutManager implementation:
+
+void VirtualKeyboardContainerLayoutManager::OnWindowResized() {
+ keyboard::KeyboardController* keyboard_controller =
+ keyboard::KeyboardController::GetInstance();
+ if (!keyboard_controller)
+ return;
+
+ // The layout manager for the root window propagates a resize to its
+ // immediate children and grandchildren, but stops there. The keyboard
+ // container is three levels deep, and therefore needs to be explicitly
+ // update when its parent is resized.
James Cook 2014/09/29 21:38:00 nit: updated
+ aura::Window* keyboard_container =
+ keyboard_controller->GetContainerWindow();
+ if (keyboard_container)
+ keyboard_container->SetBounds(parent_container_->bounds());
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698