| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ui.h" | 5 #include "ui/keyboard/keyboard_ui.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/base/ime/input_method.h" | 8 #include "ui/base/ime/input_method.h" |
| 9 #include "ui/base/ime/text_input_client.h" | 9 #include "ui/base/ime/text_input_client.h" |
| 10 #include "ui/keyboard/keyboard_controller.h" | 10 #include "ui/keyboard/keyboard_controller.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void KeyboardUI::HideKeyboardContainer(aura::Window* container) { | 24 void KeyboardUI::HideKeyboardContainer(aura::Window* container) { |
| 25 if (HasKeyboardWindow()) { | 25 if (HasKeyboardWindow()) { |
| 26 container->Hide(); | 26 container->Hide(); |
| 27 GetKeyboardWindow()->Hide(); | 27 GetKeyboardWindow()->Hide(); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 void KeyboardUI::EnsureCaretInWorkArea() { | 31 void KeyboardUI::EnsureCaretInWorkArea() { |
| 32 if (GetInputMethod()->GetTextInputClient()) { | 32 if (GetInputMethod()->GetTextInputClient()) { |
| 33 aura::Window* keyboard_window = GetKeyboardWindow(); | 33 aura::Window* keyboard_window = GetKeyboardWindow(); |
| 34 aura::Window* root_window = keyboard_window->GetRootWindow(); | 34 GetInputMethod()->GetTextInputClient()->EnsureCaretNotInRect( |
| 35 gfx::Rect available_bounds = root_window->bounds(); | 35 keyboard_window->GetBoundsInScreen()); |
| 36 gfx::Rect keyboard_bounds = keyboard_window->bounds(); | |
| 37 available_bounds.set_height(available_bounds.height() - | |
| 38 keyboard_bounds.height()); | |
| 39 GetInputMethod()->GetTextInputClient()->EnsureCaretInRect(available_bounds); | |
| 40 } | 36 } |
| 41 } | 37 } |
| 42 | 38 |
| 43 void KeyboardUI::SetController(KeyboardController* controller) { | 39 void KeyboardUI::SetController(KeyboardController* controller) { |
| 44 keyboard_controller_ = controller; | 40 keyboard_controller_ = controller; |
| 45 } | 41 } |
| 46 | 42 |
| 47 } // namespace keyboard | 43 } // namespace keyboard |
| OLD | NEW |