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

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

Issue 2801213002: Output warning when the container window doesn't exist unexpectedly (Closed)
Patch Set: Used DCHECK only and commented retionale why the windw should have been created. Created 3 years, 8 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 | no next file » | 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 input_method_ = NULL; 403 input_method_ = NULL;
404 } 404 }
405 405
406 void KeyboardController::OnShowImeIfNeeded() { 406 void KeyboardController::OnShowImeIfNeeded() {
407 // Calling |ShowKeyboardInternal| may move the keyboard to another display. 407 // Calling |ShowKeyboardInternal| may move the keyboard to another display.
408 if (IsKeyboardEnabled() && !keyboard_locked()) 408 if (IsKeyboardEnabled() && !keyboard_locked())
409 ShowKeyboardInternal(display::kInvalidDisplayId); 409 ShowKeyboardInternal(display::kInvalidDisplayId);
410 } 410 }
411 411
412 void KeyboardController::ShowKeyboardInternal(int64_t display_id) { 412 void KeyboardController::ShowKeyboardInternal(int64_t display_id) {
413 if (!container_.get()) 413 // The container window should have been created already when
414 return; 414 // |Shell::CreateKeyboard| is called.
415 DCHECK(container_.get());
415 416
416 if (container_->children().empty()) { 417 if (container_->children().empty()) {
417 keyboard::MarkKeyboardLoadStarted(); 418 keyboard::MarkKeyboardLoadStarted();
418 aura::Window* keyboard = ui_->GetKeyboardWindow(); 419 aura::Window* keyboard = ui_->GetKeyboardWindow();
419 keyboard->Show(); 420 keyboard->Show();
420 container_->AddChild(keyboard); 421 container_->AddChild(keyboard);
421 keyboard->set_owned_by_parent(false); 422 keyboard->set_owned_by_parent(false);
422 } 423 }
423 424
424 ui_->ReloadKeyboardIfNeeded(); 425 ui_->ReloadKeyboardIfNeeded();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 int keyboard_height = GetContainerWindow()->bounds().height(); 523 int keyboard_height = GetContainerWindow()->bounds().height();
523 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); 524 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds();
524 gfx::Rect new_bounds = root_bounds; 525 gfx::Rect new_bounds = root_bounds;
525 new_bounds.set_y(root_bounds.height() - keyboard_height); 526 new_bounds.set_y(root_bounds.height() - keyboard_height);
526 new_bounds.set_height(keyboard_height); 527 new_bounds.set_height(keyboard_height);
527 GetContainerWindow()->SetBounds(new_bounds); 528 GetContainerWindow()->SetBounds(new_bounds);
528 } 529 }
529 } 530 }
530 531
531 } // namespace keyboard 532 } // namespace keyboard
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698