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 "ui/aura/layout_manager.h" | 7 #include "ui/aura/layout_manager.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura/window_delegate.h" | 9 #include "ui/aura/window_delegate.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (!container_) { | 135 if (!container_) { |
136 container_ = new aura::Window(new KeyboardWindowDelegate()); | 136 container_ = new aura::Window(new KeyboardWindowDelegate()); |
137 container_->SetName("KeyboardContainer"); | 137 container_->SetName("KeyboardContainer"); |
138 container_->Init(ui::LAYER_NOT_DRAWN); | 138 container_->Init(ui::LAYER_NOT_DRAWN); |
139 container_->AddObserver(this); | 139 container_->AddObserver(this); |
140 container_->SetLayoutManager(new KeyboardLayoutManager(container_)); | 140 container_->SetLayoutManager(new KeyboardLayoutManager(container_)); |
141 } | 141 } |
142 return container_; | 142 return container_; |
143 } | 143 } |
144 | 144 |
| 145 void KeyboardController::HideKeyboard() { |
| 146 if (!container_) |
| 147 return; |
| 148 |
| 149 FOR_EACH_OBSERVER( |
| 150 KeyboardControllerObserver, |
| 151 observer_list_, |
| 152 OnKeyboardBoundsChanging(gfx::Rect())); |
| 153 |
| 154 proxy_->HideKeyboardContainer(container_); |
| 155 } |
| 156 |
145 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { | 157 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { |
146 observer_list_.AddObserver(observer); | 158 observer_list_.AddObserver(observer); |
147 } | 159 } |
148 | 160 |
149 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { | 161 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { |
150 observer_list_.RemoveObserver(observer); | 162 observer_list_.RemoveObserver(observer); |
151 } | 163 } |
152 | 164 |
153 void KeyboardController::OnWindowHierarchyChanged( | 165 void KeyboardController::OnWindowHierarchyChanged( |
154 const HierarchyChangeParams& params) { | 166 const HierarchyChangeParams& params) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // abandon compositions in progress) | 213 // abandon compositions in progress) |
202 } | 214 } |
203 | 215 |
204 void KeyboardController::OnInputMethodDestroyed( | 216 void KeyboardController::OnInputMethodDestroyed( |
205 const ui::InputMethod* input_method) { | 217 const ui::InputMethod* input_method) { |
206 DCHECK_EQ(input_method_, input_method); | 218 DCHECK_EQ(input_method_, input_method); |
207 input_method_ = NULL; | 219 input_method_ = NULL; |
208 } | 220 } |
209 | 221 |
210 } // namespace keyboard | 222 } // namespace keyboard |
OLD | NEW |