| OLD | NEW |
| 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" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 125 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 126 switches::kAshDisableScreenOrientationLock); | 126 switches::kAshDisableScreenOrientationLock); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ScreenOrientationController::SetRotationLocked(bool rotation_locked) { | 129 void ScreenOrientationController::SetRotationLocked(bool rotation_locked) { |
| 130 if (rotation_locked_ == rotation_locked) | 130 if (rotation_locked_ == rotation_locked) |
| 131 return; | 131 return; |
| 132 rotation_locked_ = rotation_locked; | 132 rotation_locked_ = rotation_locked; |
| 133 if (!rotation_locked_) | 133 if (!rotation_locked_) |
| 134 rotation_locked_orientation_ = blink::WebScreenOrientationLockAny; | 134 rotation_locked_orientation_ = blink::WebScreenOrientationLockAny; |
| 135 FOR_EACH_OBSERVER(Observer, observers_, | 135 for (auto& observer : observers_) |
| 136 OnRotationLockChanged(rotation_locked_)); | 136 observer.OnRotationLockChanged(rotation_locked_); |
| 137 if (!display::Display::HasInternalDisplay()) | 137 if (!display::Display::HasInternalDisplay()) |
| 138 return; | 138 return; |
| 139 base::AutoReset<bool> auto_ignore_display_configuration_updates( | 139 base::AutoReset<bool> auto_ignore_display_configuration_updates( |
| 140 &ignore_display_configuration_updates_, true); | 140 &ignore_display_configuration_updates_, true); |
| 141 Shell::GetInstance()->display_manager()->RegisterDisplayRotationProperties( | 141 Shell::GetInstance()->display_manager()->RegisterDisplayRotationProperties( |
| 142 rotation_locked_, current_rotation_); | 142 rotation_locked_, current_rotation_); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void ScreenOrientationController::SetDisplayRotation( | 145 void ScreenOrientationController::SetDisplayRotation( |
| 146 display::Display::Rotation rotation, | 146 display::Display::Rotation rotation, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 418 } |
| 419 | 419 |
| 420 bool ScreenOrientationController::CanRotateInLockedState() { | 420 bool ScreenOrientationController::CanRotateInLockedState() { |
| 421 return rotation_locked_orientation_ == | 421 return rotation_locked_orientation_ == |
| 422 blink::WebScreenOrientationLockLandscape || | 422 blink::WebScreenOrientationLockLandscape || |
| 423 rotation_locked_orientation_ == | 423 rotation_locked_orientation_ == |
| 424 blink::WebScreenOrientationLockPortrait; | 424 blink::WebScreenOrientationLockPortrait; |
| 425 } | 425 } |
| 426 | 426 |
| 427 } // namespace ash | 427 } // namespace ash |
| OLD | NEW |