| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/location.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 13 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
| 15 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 16 #include "ui/base/cursor/cursor.h" | 19 #include "ui/base/cursor/cursor.h" |
| 17 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
| 18 #include "ui/base/ime/input_method.h" | 21 #include "ui/base/ime/input_method.h" |
| 19 #include "ui/base/ime/text_input_client.h" | 22 #include "ui/base/ime/text_input_client.h" |
| 20 #include "ui/compositor/layer_animation_observer.h" | 23 #include "ui/compositor/layer_animation_observer.h" |
| 21 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 if (!container_.get()) | 356 if (!container_.get()) |
| 354 return; | 357 return; |
| 355 | 358 |
| 356 type_ = client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; | 359 type_ = client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; |
| 357 | 360 |
| 358 if (type_ == ui::TEXT_INPUT_TYPE_NONE && !lock_keyboard_) { | 361 if (type_ == ui::TEXT_INPUT_TYPE_NONE && !lock_keyboard_) { |
| 359 if (keyboard_visible_) { | 362 if (keyboard_visible_) { |
| 360 // Set the visibility state here so that any queries for visibility | 363 // Set the visibility state here so that any queries for visibility |
| 361 // before the timer fires returns the correct future value. | 364 // before the timer fires returns the correct future value. |
| 362 keyboard_visible_ = false; | 365 keyboard_visible_ = false; |
| 363 base::MessageLoop::current()->PostDelayedTask( | 366 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 364 FROM_HERE, | 367 FROM_HERE, |
| 365 base::Bind(&KeyboardController::HideKeyboard, | 368 base::Bind(&KeyboardController::HideKeyboard, |
| 366 weak_factory_.GetWeakPtr(), HIDE_REASON_AUTOMATIC), | 369 weak_factory_.GetWeakPtr(), HIDE_REASON_AUTOMATIC), |
| 367 base::TimeDelta::FromMilliseconds(kHideKeyboardDelayMs)); | 370 base::TimeDelta::FromMilliseconds(kHideKeyboardDelayMs)); |
| 368 } | 371 } |
| 369 } else { | 372 } else { |
| 370 // Abort a pending keyboard hide. | 373 // Abort a pending keyboard hide. |
| 371 if (WillHideKeyboard()) { | 374 if (WillHideKeyboard()) { |
| 372 weak_factory_.InvalidateWeakPtrs(); | 375 weak_factory_.InvalidateWeakPtrs(); |
| 373 keyboard_visible_ = true; | 376 keyboard_visible_ = true; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // background during animation. | 482 // background during animation. |
| 480 NotifyKeyboardBoundsChanging(container_->bounds()); | 483 NotifyKeyboardBoundsChanging(container_->bounds()); |
| 481 ui_->EnsureCaretInWorkArea(); | 484 ui_->EnsureCaretInWorkArea(); |
| 482 } | 485 } |
| 483 | 486 |
| 484 void KeyboardController::HideAnimationFinished() { | 487 void KeyboardController::HideAnimationFinished() { |
| 485 ui_->HideKeyboardContainer(container_.get()); | 488 ui_->HideKeyboardContainer(container_.get()); |
| 486 } | 489 } |
| 487 | 490 |
| 488 } // namespace keyboard | 491 } // namespace keyboard |
| OLD | NEW |