Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ash/rotator/screen_rotation_animator.cc

Issue 1108473002: Fixed the ScreenOrientationController so that it doesn't crash by animating (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary #include from screen_orientation_controller_chromeos_unittest.cc. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/rotator/screen_rotation_animator.h" 5 #include "ash/rotator/screen_rotation_animator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 } // namespace 273 } // namespace
274 274
275 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) 275 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id)
276 : display_id_(display_id) { 276 : display_id_(display_id) {
277 } 277 }
278 278
279 ScreenRotationAnimator::~ScreenRotationAnimator() { 279 ScreenRotationAnimator::~ScreenRotationAnimator() {
280 } 280 }
281 281
282 bool ScreenRotationAnimator::CanAnimate() const {
283 return Shell::GetInstance()
284 ->display_manager()
285 ->GetDisplayForId(display_id_)
286 .is_valid();
287 }
288
282 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation, 289 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation,
283 gfx::Display::RotationSource source) { 290 gfx::Display::RotationSource source) {
284 const gfx::Display::Rotation current_rotation = 291 const gfx::Display::Rotation current_rotation =
285 GetCurrentRotation(display_id_); 292 GetCurrentRotation(display_id_);
286 293
287 if (current_rotation == new_rotation) 294 if (current_rotation == new_rotation)
288 return; 295 return;
289 296
290 const std::string switch_value = 297 const std::string switch_value =
291 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 298 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
(...skipping 20 matching lines...) Expand all
312 RotateScreen(display_id_, new_rotation, source, 319 RotateScreen(display_id_, new_rotation, source,
313 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), 320 base::TimeDelta::FromMilliseconds(kRotationDurationInMs),
314 rotation_degrees, 0 /* rotation_degree_offset */, 321 rotation_degrees, 0 /* rotation_degree_offset */,
315 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); 322 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */);
316 } else { 323 } else {
317 NOTREACHED(); 324 NOTREACHED();
318 } 325 }
319 } 326 }
320 327
321 } // namespace ash 328 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698