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

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

Issue 2445583002: Relocate display_manager from ash to ui (Closed)
Patch Set: fix windows build Created 4 years, 1 month 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
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
11 #include "ash/display/display_configuration_controller.h" 11 #include "ash/display/display_configuration_controller.h"
12 #include "ash/display/display_manager.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
14 #include "base/auto_reset.h" 13 #include "base/auto_reset.h"
15 #include "base/command_line.h" 14 #include "base/command_line.h"
16 #include "chromeos/accelerometer/accelerometer_reader.h" 15 #include "chromeos/accelerometer/accelerometer_reader.h"
17 #include "chromeos/accelerometer/accelerometer_types.h" 16 #include "chromeos/accelerometer/accelerometer_types.h"
18 #include "ui/chromeos/accelerometer/accelerometer_util.h" 17 #include "ui/chromeos/accelerometer/accelerometer_util.h"
19 #include "ui/display/display.h" 18 #include "ui/display/display.h"
19 #include "ui/display/manager/display_manager.h"
20 #include "ui/display/manager/managed_display_info.h" 20 #include "ui/display/manager/managed_display_info.h"
21 #include "ui/gfx/geometry/size.h" 21 #include "ui/gfx/geometry/size.h"
22 22
23 namespace ash { 23 namespace ash {
24 24
25 namespace { 25 namespace {
26 26
27 // The angle which the screen has to be rotated past before the display will 27 // The angle which the screen has to be rotated past before the display will
28 // rotate to match it (i.e. 45.0f is no stickiness). 28 // rotate to match it (i.e. 45.0f is no stickiness).
29 const float kDisplayRotationStickyAngleDegrees = 60.0f; 29 const float kDisplayRotationStickyAngleDegrees = 60.0f;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 new_rotation = display::Display::ROTATE_180; 370 new_rotation = display::Display::ROTATE_180;
371 371
372 if (new_rotation != current_rotation_ && 372 if (new_rotation != current_rotation_ &&
373 IsRotationAllowedInLockedState(new_rotation)) { 373 IsRotationAllowedInLockedState(new_rotation)) {
374 SetDisplayRotation(new_rotation, 374 SetDisplayRotation(new_rotation,
375 display::Display::ROTATION_SOURCE_ACCELEROMETER); 375 display::Display::ROTATION_SOURCE_ACCELEROMETER);
376 } 376 }
377 } 377 }
378 378
379 void ScreenOrientationController::LoadDisplayRotationProperties() { 379 void ScreenOrientationController::LoadDisplayRotationProperties() {
380 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 380 display::DisplayManager* display_manager =
381 Shell::GetInstance()->display_manager();
381 if (!display_manager->registered_internal_display_rotation_lock()) 382 if (!display_manager->registered_internal_display_rotation_lock())
382 return; 383 return;
383 SetDisplayRotation(display_manager->registered_internal_display_rotation(), 384 SetDisplayRotation(display_manager->registered_internal_display_rotation(),
384 display::Display::ROTATION_SOURCE_ACCELEROMETER); 385 display::Display::ROTATION_SOURCE_ACCELEROMETER);
385 SetRotationLocked(true); 386 SetRotationLocked(true);
386 } 387 }
387 388
388 void ScreenOrientationController::ApplyLockForActiveWindow() { 389 void ScreenOrientationController::ApplyLockForActiveWindow() {
389 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 390 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
390 if (active_window) { 391 if (active_window) {
(...skipping 27 matching lines...) Expand all
418 } 419 }
419 420
420 bool ScreenOrientationController::CanRotateInLockedState() { 421 bool ScreenOrientationController::CanRotateInLockedState() {
421 return rotation_locked_orientation_ == 422 return rotation_locked_orientation_ ==
422 blink::WebScreenOrientationLockLandscape || 423 blink::WebScreenOrientationLockLandscape ||
423 rotation_locked_orientation_ == 424 rotation_locked_orientation_ ==
424 blink::WebScreenOrientationLockPortrait; 425 blink::WebScreenOrientationLockPortrait;
425 } 426 }
426 427
427 } // namespace ash 428 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698