OLD | NEW |
---|---|
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 input_method_ = NULL; | 399 input_method_ = NULL; |
400 } | 400 } |
401 | 401 |
402 void KeyboardController::OnShowImeIfNeeded() { | 402 void KeyboardController::OnShowImeIfNeeded() { |
403 // Calling |ShowKeyboardInternal| may move the keyboard to another display. | 403 // Calling |ShowKeyboardInternal| may move the keyboard to another display. |
404 if (IsKeyboardEnabled() && !keyboard_locked()) | 404 if (IsKeyboardEnabled() && !keyboard_locked()) |
405 ShowKeyboardInternal(display::kInvalidDisplayId); | 405 ShowKeyboardInternal(display::kInvalidDisplayId); |
406 } | 406 } |
407 | 407 |
408 void KeyboardController::ShowKeyboardInternal(int64_t display_id) { | 408 void KeyboardController::ShowKeyboardInternal(int64_t display_id) { |
409 if (!container_.get()) | 409 DCHECK(container_.get()); |
410 if (!container_.get()) { | |
411 LOG(WARNING) << "container_ was not initialized unexpectedly."; | |
bshe
2017/04/10 13:38:37
If you have a DCHECK, you shouldn't need to handle
oka
2017/04/13 09:07:57
Done. I added DCHECK only and commened the rationa
| |
410 return; | 412 return; |
413 } | |
411 | 414 |
412 if (container_->children().empty()) { | 415 if (container_->children().empty()) { |
413 keyboard::MarkKeyboardLoadStarted(); | 416 keyboard::MarkKeyboardLoadStarted(); |
414 aura::Window* keyboard = ui_->GetKeyboardWindow(); | 417 aura::Window* keyboard = ui_->GetKeyboardWindow(); |
415 keyboard->Show(); | 418 keyboard->Show(); |
416 container_->AddChild(keyboard); | 419 container_->AddChild(keyboard); |
417 keyboard->set_owned_by_parent(false); | 420 keyboard->set_owned_by_parent(false); |
418 } | 421 } |
419 | 422 |
420 ui_->ReloadKeyboardIfNeeded(); | 423 ui_->ReloadKeyboardIfNeeded(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 int keyboard_height = GetContainerWindow()->bounds().height(); | 521 int keyboard_height = GetContainerWindow()->bounds().height(); |
519 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); | 522 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); |
520 gfx::Rect new_bounds = root_bounds; | 523 gfx::Rect new_bounds = root_bounds; |
521 new_bounds.set_y(root_bounds.height() - keyboard_height); | 524 new_bounds.set_y(root_bounds.height() - keyboard_height); |
522 new_bounds.set_height(keyboard_height); | 525 new_bounds.set_height(keyboard_height); |
523 GetContainerWindow()->SetBounds(new_bounds); | 526 GetContainerWindow()->SetBounds(new_bounds); |
524 } | 527 } |
525 } | 528 } |
526 | 529 |
527 } // namespace keyboard | 530 } // namespace keyboard |
OLD | NEW |