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

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 1138873003: Restore virtual keyboard after switch back to FULL_WIDTH mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/keyboard/keyboard_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void KeyboardController::SetKeyboardMode(KeyboardMode mode) { 336 void KeyboardController::SetKeyboardMode(KeyboardMode mode) {
337 if (keyboard_mode_ == mode) 337 if (keyboard_mode_ == mode)
338 return; 338 return;
339 339
340 keyboard_mode_ = mode; 340 keyboard_mode_ = mode;
341 // When keyboard is floating, no overscroll or resize is necessary. Sets 341 // When keyboard is floating, no overscroll or resize is necessary. Sets
342 // keyboard bounds to zero so overscroll or resize is disabled. 342 // keyboard bounds to zero so overscroll or resize is disabled.
343 if (keyboard_mode_ == FLOATING) { 343 if (keyboard_mode_ == FLOATING) {
344 NotifyKeyboardBoundsChanging(gfx::Rect()); 344 NotifyKeyboardBoundsChanging(gfx::Rect());
345 } else if (keyboard_mode_ == FULL_WIDTH) { 345 } else if (keyboard_mode_ == FULL_WIDTH) {
346 // TODO(bshe): handle switch to FULL_WIDTH from FLOATING mode. We need a way 346 // TODO(bshe): revisit this logic after we decide to support resize virtual
347 // to know the height of virtual keyboard in FULL_WIDTH mode before here. 347 // keyboard.
348 int keyboard_height = GetContainerWindow()->bounds().height();
349 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds();
350 gfx::Rect new_bounds = root_bounds;
351 new_bounds.set_y(root_bounds.height() - keyboard_height);
352 new_bounds.set_height(keyboard_height);
353 GetContainerWindow()->SetBounds(new_bounds);
354 // No animation added, so call ShowAnimationFinished immediately.
355 ShowAnimationFinished();
348 } 356 }
349 } 357 }
350 358
351 void KeyboardController::ShowKeyboard(bool lock) { 359 void KeyboardController::ShowKeyboard(bool lock) {
352 set_lock_keyboard(lock); 360 set_lock_keyboard(lock);
353 ShowKeyboardInternal(); 361 ShowKeyboardInternal();
354 } 362 }
355 363
356 void KeyboardController::OnWindowHierarchyChanged( 364 void KeyboardController::OnWindowHierarchyChanged(
357 const HierarchyChangeParams& params) { 365 const HierarchyChangeParams& params) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 proxy_->HideKeyboardContainer(container_.get()); 593 proxy_->HideKeyboardContainer(container_.get());
586 } 594 }
587 595
588 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { 596 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) {
589 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; 597 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr;
590 if (target_window) 598 if (target_window)
591 window_bounds_observer_->AddObservedWindow(target_window); 599 window_bounds_observer_->AddObservedWindow(target_window);
592 } 600 }
593 601
594 } // namespace keyboard 602 } // namespace keyboard
OLDNEW
« no previous file with comments | « no previous file | ui/keyboard/keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698