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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 const int kHideKeyboardDelayMs = 100; | 39 const int kHideKeyboardDelayMs = 100; |
40 | 40 |
41 // The virtual keyboard show/hide animation duration. | 41 // The virtual keyboard show/hide animation duration. |
42 const int kShowAnimationDurationMs = 350; | 42 const int kShowAnimationDurationMs = 350; |
43 const int kHideAnimationDurationMs = 100; | 43 const int kHideAnimationDurationMs = 100; |
44 | 44 |
45 // The opacity of virtual keyboard container when show animation starts or | 45 // The opacity of virtual keyboard container when show animation starts or |
46 // hide animation finishes. | 46 // hide animation finishes. This cannot be zero because we call Show() on the |
47 // TODO(rsadam@): Investigate why setting this to zero crashes. | 47 // keyboard window before setting the opacity back to 1.0. Since windows are not |
| 48 // allowed to be shown with zero opacity, we always animate to 0.01 instead. |
48 const float kAnimationStartOrAfterHideOpacity = 0.01f; | 49 const float kAnimationStartOrAfterHideOpacity = 0.01f; |
49 | 50 |
50 // Event targeter for the keyboard container. | 51 // Event targeter for the keyboard container. |
51 class KeyboardContainerTargeter : public wm::MaskedWindowTargeter { | 52 class KeyboardContainerTargeter : public wm::MaskedWindowTargeter { |
52 public: | 53 public: |
53 KeyboardContainerTargeter(aura::Window* container, | 54 KeyboardContainerTargeter(aura::Window* container, |
54 keyboard::KeyboardControllerProxy* proxy) | 55 keyboard::KeyboardControllerProxy* proxy) |
55 : wm::MaskedWindowTargeter(container), | 56 : wm::MaskedWindowTargeter(container), |
56 proxy_(proxy) { | 57 proxy_(proxy) { |
57 } | 58 } |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 proxy_->HideKeyboardContainer(container_.get()); | 578 proxy_->HideKeyboardContainer(container_.get()); |
578 } | 579 } |
579 | 580 |
580 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 581 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
581 aura::Window* target_window = GetFrameWindow(window); | 582 aura::Window* target_window = GetFrameWindow(window); |
582 if (target_window) | 583 if (target_window) |
583 window_bounds_observer_->AddObservedWindow(target_window); | 584 window_bounds_observer_->AddObservedWindow(target_window); |
584 } | 585 } |
585 | 586 |
586 } // namespace keyboard | 587 } // namespace keyboard |
OLD | NEW |