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 "ui/aura/layout_manager.h" | 9 #include "ui/aura/layout_manager.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if (was_showing != should_show) { | 244 if (was_showing != should_show) { |
245 if (should_show) { | 245 if (should_show) { |
246 keyboard_visible_ = true; | 246 keyboard_visible_ = true; |
247 | 247 |
248 // If the controller is in the process of hiding the keyboard, do not log | 248 // If the controller is in the process of hiding the keyboard, do not log |
249 // the stat here since the keyboard will not actually be shown. | 249 // the stat here since the keyboard will not actually be shown. |
250 if (!WillHideKeyboard()) | 250 if (!WillHideKeyboard()) |
251 keyboard::LogKeyboardControlEvent(keyboard::KEYBOARD_CONTROL_SHOW); | 251 keyboard::LogKeyboardControlEvent(keyboard::KEYBOARD_CONTROL_SHOW); |
252 | 252 |
253 weak_factory_.InvalidateWeakPtrs(); | 253 weak_factory_.InvalidateWeakPtrs(); |
254 if (container_->IsVisible()) | 254 // If |container_| has hide animation, its visibility is set to false when |
| 255 // hide animation finished. So even if the container is visible at this |
| 256 // point, it may in the process of hiding. We still need to show keyboard |
| 257 // container in this case. |
| 258 if (container_->IsVisible() && |
| 259 !container_->layer()->GetAnimator()->is_animating()) { |
255 return; | 260 return; |
| 261 } |
256 | 262 |
257 NotifyKeyboardBoundsChanging(container_->children()[0]->bounds()); | 263 NotifyKeyboardBoundsChanging(container_->children()[0]->bounds()); |
258 | 264 |
259 proxy_->ShowKeyboardContainer(container_.get()); | 265 proxy_->ShowKeyboardContainer(container_.get()); |
260 } else { | 266 } else { |
261 // Set the visibility state here so that any queries for visibility | 267 // Set the visibility state here so that any queries for visibility |
262 // before the timer fires returns the correct future value. | 268 // before the timer fires returns the correct future value. |
263 keyboard_visible_ = false; | 269 keyboard_visible_ = false; |
264 base::MessageLoop::current()->PostDelayedTask( | 270 base::MessageLoop::current()->PostDelayedTask( |
265 FROM_HERE, | 271 FROM_HERE, |
(...skipping 11 matching lines...) Expand all Loading... |
277 const ui::InputMethod* input_method) { | 283 const ui::InputMethod* input_method) { |
278 DCHECK_EQ(input_method_, input_method); | 284 DCHECK_EQ(input_method_, input_method); |
279 input_method_ = NULL; | 285 input_method_ = NULL; |
280 } | 286 } |
281 | 287 |
282 bool KeyboardController::WillHideKeyboard() const { | 288 bool KeyboardController::WillHideKeyboard() const { |
283 return weak_factory_.HasWeakPtrs(); | 289 return weak_factory_.HasWeakPtrs(); |
284 } | 290 } |
285 | 291 |
286 } // namespace keyboard | 292 } // namespace keyboard |
OLD | NEW |