| 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 "ash/test/test_keyboard_ui.h" | 5 #include "ash/test/test_keyboard_ui.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/base/ime/mock_input_method.h" | 12 #include "ui/base/ime/mock_input_method.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 TestKeyboardUI::TestKeyboardUI() {} | 16 TestKeyboardUI::TestKeyboardUI() {} |
| 17 TestKeyboardUI::~TestKeyboardUI() {} | 17 TestKeyboardUI::~TestKeyboardUI() {} |
| 18 | 18 |
| 19 bool TestKeyboardUI::HasKeyboardWindow() const { | 19 bool TestKeyboardUI::HasKeyboardWindow() const { |
| 20 return keyboard_; | 20 return !!keyboard_; |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool TestKeyboardUI::ShouldWindowOverscroll(aura::Window* window) const { | 23 bool TestKeyboardUI::ShouldWindowOverscroll(aura::Window* window) const { |
| 24 return true; | 24 return true; |
| 25 } | 25 } |
| 26 | 26 |
| 27 aura::Window* TestKeyboardUI::GetKeyboardWindow() { | 27 aura::Window* TestKeyboardUI::GetKeyboardWindow() { |
| 28 if (!keyboard_) { | 28 if (!keyboard_) { |
| 29 keyboard_.reset(new aura::Window(&delegate_)); | 29 keyboard_.reset(new aura::Window(&delegate_)); |
| 30 keyboard_->Init(ui::LAYER_NOT_DRAWN); | 30 keyboard_->Init(ui::LAYER_NOT_DRAWN); |
| 31 } | 31 } |
| 32 return keyboard_.get(); | 32 return keyboard_.get(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 ui::InputMethod* TestKeyboardUI::GetInputMethod() { | 35 ui::InputMethod* TestKeyboardUI::GetInputMethod() { |
| 36 aura::Window* active_window = wm::GetActiveWindow(); | 36 aura::Window* active_window = wm::GetActiveWindow(); |
| 37 aura::Window* root_window = active_window ? active_window->GetRootWindow() | 37 aura::Window* root_window = active_window ? active_window->GetRootWindow() |
| 38 : Shell::GetPrimaryRootWindow(); | 38 : Shell::GetPrimaryRootWindow(); |
| 39 return root_window->GetHost()->GetInputMethod(); | 39 return root_window->GetHost()->GetInputMethod(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void TestKeyboardUI::SetUpdateInputType(ui::TextInputType type) {} | 42 void TestKeyboardUI::SetUpdateInputType(ui::TextInputType type) {} |
| 43 void TestKeyboardUI::ReloadKeyboardIfNeeded() {} | 43 void TestKeyboardUI::ReloadKeyboardIfNeeded() {} |
| 44 void TestKeyboardUI::InitInsets(const gfx::Rect& keyboard_bounds) {} | 44 void TestKeyboardUI::InitInsets(const gfx::Rect& keyboard_bounds) {} |
| 45 void TestKeyboardUI::ResetInsets() {} | 45 void TestKeyboardUI::ResetInsets() {} |
| 46 | 46 |
| 47 } // namespace ash | 47 } // namespace ash |
| OLD | NEW |