Chromium Code Reviews| 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 "ui/aura/layout_manager.h" | 8 #include "ui/aura/layout_manager.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_delegate.h" | 10 #include "ui/aura/window_delegate.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 if (!container_) { | 140 if (!container_) { |
| 141 container_ = new aura::Window(new KeyboardWindowDelegate()); | 141 container_ = new aura::Window(new KeyboardWindowDelegate()); |
| 142 container_->SetName("KeyboardContainer"); | 142 container_->SetName("KeyboardContainer"); |
| 143 container_->Init(ui::LAYER_NOT_DRAWN); | 143 container_->Init(ui::LAYER_NOT_DRAWN); |
| 144 container_->AddObserver(this); | 144 container_->AddObserver(this); |
| 145 container_->SetLayoutManager(new KeyboardLayoutManager(container_)); | 145 container_->SetLayoutManager(new KeyboardLayoutManager(container_)); |
| 146 } | 146 } |
| 147 return container_; | 147 return container_; |
| 148 } | 148 } |
| 149 | 149 |
| 150 void KeyboardController::HideKeyboard() { | |
|
bshe
2013/09/09 19:03:55
drive-by: probably need to update keyboard_visible
SteveT
2013/09/10 14:25:10
Done. PTAL at the new comment I added.
| |
| 151 FOR_EACH_OBSERVER( | |
| 152 KeyboardControllerObserver, | |
| 153 observer_list_, | |
| 154 OnKeyboardBoundsChanging(gfx::Rect())); | |
| 155 | |
| 156 proxy_->HideKeyboardContainer(container_); | |
| 157 } | |
| 158 | |
| 150 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { | 159 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { |
| 151 observer_list_.AddObserver(observer); | 160 observer_list_.AddObserver(observer); |
| 152 } | 161 } |
| 153 | 162 |
| 154 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { | 163 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { |
| 155 observer_list_.RemoveObserver(observer); | 164 observer_list_.RemoveObserver(observer); |
| 156 } | 165 } |
| 157 | 166 |
| 158 void KeyboardController::OnWindowHierarchyChanged( | 167 void KeyboardController::OnWindowHierarchyChanged( |
| 159 const HierarchyChangeParams& params) { | 168 const HierarchyChangeParams& params) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // keyboard (with the TextInputType) so that it can reset it's state (e.g. | 220 // keyboard (with the TextInputType) so that it can reset it's state (e.g. |
| 212 // abandon compositions in progress) | 221 // abandon compositions in progress) |
| 213 } | 222 } |
| 214 | 223 |
| 215 void KeyboardController::OnInputMethodDestroyed( | 224 void KeyboardController::OnInputMethodDestroyed( |
| 216 const ui::InputMethod* input_method) { | 225 const ui::InputMethod* input_method) { |
| 217 DCHECK_EQ(input_method_, input_method); | 226 DCHECK_EQ(input_method_, input_method); |
| 218 input_method_ = NULL; | 227 input_method_ = NULL; |
| 219 } | 228 } |
| 220 | 229 |
| 221 void KeyboardController::HideKeyboard() { | |
| 222 FOR_EACH_OBSERVER(KeyboardControllerObserver, | |
| 223 observer_list_, | |
| 224 OnKeyboardBoundsChanging(gfx::Rect())); | |
| 225 proxy_->HideKeyboardContainer(container_); | |
| 226 } | |
| 227 | |
| 228 bool KeyboardController::WillHideKeyboard() const { | 230 bool KeyboardController::WillHideKeyboard() const { |
| 229 return weak_factory_.HasWeakPtrs(); | 231 return weak_factory_.HasWeakPtrs(); |
| 230 } | 232 } |
| 231 | 233 |
| 232 } // namespace keyboard | 234 } // namespace keyboard |
| OLD | NEW |