| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/display/display_configuration_controller.h" | 5 #include "ash/display/display_configuration_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_animator.h" | 7 #include "ash/display/display_animator.h" |
| 8 #include "ash/display/display_animator_chromeos.h" | 8 #include "ash/display/display_animator_chromeos.h" |
| 9 #include "ash/display/display_util.h" | 9 #include "ash/display/display_util.h" |
| 10 #include "ash/rotator/screen_rotation_animator.h" | 10 #include "ash/rotator/screen_rotation_animator.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } else { | 126 } else { |
| 127 SetPrimaryDisplayIdImpl(display_id); | 127 SetPrimaryDisplayIdImpl(display_id); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 void DisplayConfigurationController::OnDisplayConfigurationChanged() { | 131 void DisplayConfigurationController::OnDisplayConfigurationChanged() { |
| 132 // TODO(oshima): Stop all animations. | 132 // TODO(oshima): Stop all animations. |
| 133 SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); | 133 SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void DisplayConfigurationController::OnScreenRotationAnimationFinished( | |
| 137 ScreenRotationAnimator* screen_rotation_animator) { | |
| 138 const int64_t display_id = screen_rotation_animator->display_id(); | |
| 139 | |
| 140 DCHECK(rotation_animator_map_.count(display_id)); | |
| 141 | |
| 142 screen_rotation_animator->RemoveScreenRotationAnimatorObserver(this); | |
| 143 rotation_animator_map_.erase(screen_rotation_animator->display_id()); | |
| 144 } | |
| 145 | |
| 146 // Protected | 136 // Protected |
| 147 | 137 |
| 148 void DisplayConfigurationController::ResetAnimatorForTest() { | 138 void DisplayConfigurationController::ResetAnimatorForTest() { |
| 149 if (!display_animator_) | 139 if (!display_animator_) |
| 150 return; | 140 return; |
| 151 display_animator_.reset(); | 141 display_animator_.reset(); |
| 152 } | 142 } |
| 153 | 143 |
| 154 // Private | 144 // Private |
| 155 | 145 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 183 } | 173 } |
| 184 | 174 |
| 185 ScreenRotationAnimator* | 175 ScreenRotationAnimator* |
| 186 DisplayConfigurationController::GetScreenRotationAnimatorForDisplay( | 176 DisplayConfigurationController::GetScreenRotationAnimatorForDisplay( |
| 187 int64_t display_id) { | 177 int64_t display_id) { |
| 188 auto iter = rotation_animator_map_.find(display_id); | 178 auto iter = rotation_animator_map_.find(display_id); |
| 189 if (iter != rotation_animator_map_.end()) | 179 if (iter != rotation_animator_map_.end()) |
| 190 return iter->second.get(); | 180 return iter->second.get(); |
| 191 | 181 |
| 192 auto animator = base::MakeUnique<ScreenRotationAnimator>(display_id); | 182 auto animator = base::MakeUnique<ScreenRotationAnimator>(display_id); |
| 193 animator->AddScreenRotationAnimatorObserver(this); | |
| 194 ScreenRotationAnimator* result = animator.get(); | 183 ScreenRotationAnimator* result = animator.get(); |
| 195 rotation_animator_map_.insert( | 184 rotation_animator_map_.insert( |
| 196 std::make_pair(display_id, std::move(animator))); | 185 std::make_pair(display_id, std::move(animator))); |
| 197 return result; | 186 return result; |
| 198 } | 187 } |
| 199 | 188 |
| 200 } // namespace ash | 189 } // namespace ash |
| OLD | NEW |