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

Side by Side Diff: ash/display/screen_orientation_controller_chromeos.cc

Issue 1594683002: Introduce DisplayConfigurationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_576375_display1b1
Patch Set: Rebase Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/screen_orientation_controller_chromeos.h" 5 #include "ash/display/screen_orientation_controller_chromeos.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_info.h" 8 #include "ash/display/display_info.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/rotator/screen_rotation_animator.h"
11 #include "ash/shell.h" 10 #include "ash/shell.h"
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
13 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
14 #include "base/command_line.h" 13 #include "base/command_line.h"
15 #include "chromeos/accelerometer/accelerometer_reader.h" 14 #include "chromeos/accelerometer/accelerometer_reader.h"
16 #include "chromeos/accelerometer/accelerometer_types.h" 15 #include "chromeos/accelerometer/accelerometer_types.h"
17 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
18 #include "ui/aura/window_observer.h" 17 #include "ui/aura/window_observer.h"
19 #include "ui/chromeos/accelerometer/accelerometer_util.h" 18 #include "ui/chromeos/accelerometer/accelerometer_util.h"
20 #include "ui/gfx/display.h" 19 #include "ui/gfx/display.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 void ScreenOrientationController::SetDisplayRotation( 137 void ScreenOrientationController::SetDisplayRotation(
139 gfx::Display::Rotation rotation, 138 gfx::Display::Rotation rotation,
140 gfx::Display::RotationSource source) { 139 gfx::Display::RotationSource source) {
141 if (!gfx::Display::HasInternalDisplay()) 140 if (!gfx::Display::HasInternalDisplay())
142 return; 141 return;
143 current_rotation_ = rotation; 142 current_rotation_ = rotation;
144 base::AutoReset<bool> auto_ignore_display_configuration_updates( 143 base::AutoReset<bool> auto_ignore_display_configuration_updates(
145 &ignore_display_configuration_updates_, true); 144 &ignore_display_configuration_updates_, true);
146 145
147 ash::ScreenRotationAnimator screen_rotation_animator( 146 Shell::GetInstance()->display_configuration_controller()->SetDisplayRotation(
148 gfx::Display::InternalDisplayId()); 147 gfx::Display::InternalDisplayId(), rotation, source,
149 if (screen_rotation_animator.CanAnimate()) { 148 true /* user_action */);
150 screen_rotation_animator.Rotate(rotation, source);
151 } else {
152 Shell::GetInstance()->display_manager()->SetDisplayRotation(
153 gfx::Display::InternalDisplayId(), rotation, source);
154 }
155 } 149 }
156 150
157 void ScreenOrientationController::OnWindowActivated( 151 void ScreenOrientationController::OnWindowActivated(
158 aura::client::ActivationChangeObserver::ActivationReason reason, 152 aura::client::ActivationChangeObserver::ActivationReason reason,
159 aura::Window* gained_active, 153 aura::Window* gained_active,
160 aura::Window* lost_active) { 154 aura::Window* lost_active) {
161 ApplyLockForActiveWindow(); 155 ApplyLockForActiveWindow();
162 } 156 }
163 157
164 // Currently contents::WebContents will only be able to lock rotation while 158 // Currently contents::WebContents will only be able to lock rotation while
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 413 }
420 414
421 bool ScreenOrientationController::CanRotateInLockedState() { 415 bool ScreenOrientationController::CanRotateInLockedState() {
422 return rotation_locked_orientation_ == 416 return rotation_locked_orientation_ ==
423 blink::WebScreenOrientationLockLandscape || 417 blink::WebScreenOrientationLockLandscape ||
424 rotation_locked_orientation_ == 418 rotation_locked_orientation_ ==
425 blink::WebScreenOrientationLockPortrait; 419 blink::WebScreenOrientationLockPortrait;
426 } 420 }
427 421
428 } // namespace ash 422 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698