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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 } // namespace | 110 } // namespace |
111 | 111 |
112 namespace keyboard { | 112 namespace keyboard { |
113 | 113 |
114 // Observer for both keyboard show and hide animations. It should be owned by | 114 // Observer for both keyboard show and hide animations. It should be owned by |
115 // KeyboardController. | 115 // KeyboardController. |
116 class CallbackAnimationObserver : public ui::LayerAnimationObserver { | 116 class CallbackAnimationObserver : public ui::LayerAnimationObserver { |
117 public: | 117 public: |
118 CallbackAnimationObserver(ui::LayerAnimator* animator, | 118 CallbackAnimationObserver(const scoped_refptr<ui::LayerAnimator>& animator, |
119 base::Callback<void(void)> callback); | 119 base::Callback<void(void)> callback); |
120 ~CallbackAnimationObserver() override; | 120 ~CallbackAnimationObserver() override; |
121 | 121 |
122 private: | 122 private: |
123 // Overridden from ui::LayerAnimationObserver: | 123 // Overridden from ui::LayerAnimationObserver: |
124 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override; | 124 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override; |
125 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override; | 125 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override; |
126 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {} | 126 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {} |
127 | 127 |
128 ui::LayerAnimator* animator_; | 128 scoped_refptr<ui::LayerAnimator> animator_; |
129 base::Callback<void(void)> callback_; | 129 base::Callback<void(void)> callback_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); | 131 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); |
132 }; | 132 }; |
133 | 133 |
134 CallbackAnimationObserver::CallbackAnimationObserver( | 134 CallbackAnimationObserver::CallbackAnimationObserver( |
135 ui::LayerAnimator* animator, base::Callback<void(void)> callback) | 135 const scoped_refptr<ui::LayerAnimator>& animator, |
| 136 base::Callback<void(void)> callback) |
136 : animator_(animator), callback_(callback) { | 137 : animator_(animator), callback_(callback) { |
137 } | 138 } |
138 | 139 |
139 CallbackAnimationObserver::~CallbackAnimationObserver() { | 140 CallbackAnimationObserver::~CallbackAnimationObserver() { |
140 animator_->RemoveObserver(this); | 141 animator_->RemoveObserver(this); |
141 } | 142 } |
142 | 143 |
143 void CallbackAnimationObserver::OnLayerAnimationEnded( | 144 void CallbackAnimationObserver::OnLayerAnimationEnded( |
144 ui::LayerAnimationSequence* seq) { | 145 ui::LayerAnimationSequence* seq) { |
145 if (animator_->is_animating()) | 146 if (animator_->is_animating()) |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 proxy_->HideKeyboardContainer(container_.get()); | 570 proxy_->HideKeyboardContainer(container_.get()); |
570 } | 571 } |
571 | 572 |
572 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 573 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
573 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 574 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
574 if (target_window) | 575 if (target_window) |
575 window_bounds_observer_->AddObservedWindow(target_window); | 576 window_bounds_observer_->AddObservedWindow(target_window); |
576 } | 577 } |
577 | 578 |
578 } // namespace keyboard | 579 } // namespace keyboard |
OLD | NEW |