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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 class TestKeyboardUI : public KeyboardUI { | 90 class TestKeyboardUI : public KeyboardUI { |
91 public: | 91 public: |
92 TestKeyboardUI(ui::InputMethod* input_method) : input_method_(input_method) {} | 92 TestKeyboardUI(ui::InputMethod* input_method) : input_method_(input_method) {} |
93 ~TestKeyboardUI() override { | 93 ~TestKeyboardUI() override { |
94 // Destroy the window before the delegate. | 94 // Destroy the window before the delegate. |
95 window_.reset(); | 95 window_.reset(); |
96 } | 96 } |
97 | 97 |
98 // Overridden from KeyboardUI: | 98 // Overridden from KeyboardUI: |
99 bool HasKeyboardWindow() const override { return window_; } | 99 bool HasKeyboardWindow() const override { return !!window_; } |
100 bool ShouldWindowOverscroll(aura::Window* window) const override { | 100 bool ShouldWindowOverscroll(aura::Window* window) const override { |
101 return true; | 101 return true; |
102 } | 102 } |
103 aura::Window* GetKeyboardWindow() override { | 103 aura::Window* GetKeyboardWindow() override { |
104 if (!window_) { | 104 if (!window_) { |
105 window_.reset(new aura::Window(&delegate_)); | 105 window_.reset(new aura::Window(&delegate_)); |
106 window_->Init(ui::LAYER_NOT_DRAWN); | 106 window_->Init(ui::LAYER_NOT_DRAWN); |
107 window_->set_owned_by_parent(false); | 107 window_->set_owned_by_parent(false); |
108 } | 108 } |
109 return window_.get(); | 109 return window_.get(); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // Mock set keyboard size from javascript side. In floating mode, virtual | 625 // Mock set keyboard size from javascript side. In floating mode, virtual |
626 // keyboard's size is decided by client. | 626 // keyboard's size is decided by client. |
627 gfx::Rect new_bounds(0, 50, 50, 50); | 627 gfx::Rect new_bounds(0, 50, 50, 50); |
628 keyboard->SetBounds(new_bounds); | 628 keyboard->SetBounds(new_bounds); |
629 ASSERT_EQ(new_bounds, container->bounds()); | 629 ASSERT_EQ(new_bounds, container->bounds()); |
630 EXPECT_TRUE(keyboard->IsVisible()); | 630 EXPECT_TRUE(keyboard->IsVisible()); |
631 EXPECT_TRUE(container->IsVisible()); | 631 EXPECT_TRUE(container->IsVisible()); |
632 } | 632 } |
633 | 633 |
634 } // namespace keyboard | 634 } // namespace keyboard |
OLD | NEW |