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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 if (was_showing != should_show) { | 272 if (was_showing != should_show) { |
273 if (should_show) { | 273 if (should_show) { |
274 keyboard_visible_ = true; | 274 keyboard_visible_ = true; |
275 | 275 |
276 // If the controller is in the process of hiding the keyboard, do not log | 276 // If the controller is in the process of hiding the keyboard, do not log |
277 // the stat here since the keyboard will not actually be shown. | 277 // the stat here since the keyboard will not actually be shown. |
278 if (!WillHideKeyboard()) | 278 if (!WillHideKeyboard()) |
279 keyboard::LogKeyboardControlEvent(keyboard::KEYBOARD_CONTROL_SHOW); | 279 keyboard::LogKeyboardControlEvent(keyboard::KEYBOARD_CONTROL_SHOW); |
280 | 280 |
281 weak_factory_.InvalidateWeakPtrs(); | 281 weak_factory_.InvalidateWeakPtrs(); |
282 if (container_->IsVisible()) | 282 // If |container_| has hide animation, its visibility is set to false when |
| 283 // hide animation finished. So even if the container is visible at this |
| 284 // point, it may in the process of hiding. We still need to show keyboard |
| 285 // container in this case. |
| 286 if (container_->IsVisible() && |
| 287 !container_->layer()->GetAnimator()->is_animating()) { |
283 return; | 288 return; |
| 289 } |
284 | 290 |
285 NotifyKeyboardBoundsChanging(container_->children()[0]->bounds()); | 291 NotifyKeyboardBoundsChanging(container_->children()[0]->bounds()); |
286 | 292 |
287 proxy_->ShowKeyboardContainer(container_.get()); | 293 proxy_->ShowKeyboardContainer(container_.get()); |
288 } else { | 294 } else { |
289 // Set the visibility state here so that any queries for visibility | 295 // Set the visibility state here so that any queries for visibility |
290 // before the timer fires returns the correct future value. | 296 // before the timer fires returns the correct future value. |
291 keyboard_visible_ = false; | 297 keyboard_visible_ = false; |
292 base::MessageLoop::current()->PostDelayedTask( | 298 base::MessageLoop::current()->PostDelayedTask( |
293 FROM_HERE, | 299 FROM_HERE, |
(...skipping 11 matching lines...) Expand all Loading... |
305 const ui::InputMethod* input_method) { | 311 const ui::InputMethod* input_method) { |
306 DCHECK_EQ(input_method_, input_method); | 312 DCHECK_EQ(input_method_, input_method); |
307 input_method_ = NULL; | 313 input_method_ = NULL; |
308 } | 314 } |
309 | 315 |
310 bool KeyboardController::WillHideKeyboard() const { | 316 bool KeyboardController::WillHideKeyboard() const { |
311 return weak_factory_.HasWeakPtrs(); | 317 return weak_factory_.HasWeakPtrs(); |
312 } | 318 } |
313 | 319 |
314 } // namespace keyboard | 320 } // namespace keyboard |
OLD | NEW |