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/content/display/screen_orientation_controller_chromeos.h" | 5 #include "ash/content/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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (locking_windows_.find(window) == locking_windows_.end()) | 140 if (locking_windows_.find(window) == locking_windows_.end()) |
141 return; | 141 return; |
142 ApplyLockForActiveWindow(); | 142 ApplyLockForActiveWindow(); |
143 } | 143 } |
144 | 144 |
145 void ScreenOrientationController::OnWindowDestroying(aura::Window* window) { | 145 void ScreenOrientationController::OnWindowDestroying(aura::Window* window) { |
146 RemoveLockingWindow(window); | 146 RemoveLockingWindow(window); |
147 } | 147 } |
148 | 148 |
149 void ScreenOrientationController::OnAccelerometerUpdated( | 149 void ScreenOrientationController::OnAccelerometerUpdated( |
150 const chromeos::AccelerometerUpdate& update) { | 150 scoped_refptr<const chromeos::AccelerometerUpdate> update) { |
151 if (rotation_locked_ && !CanRotateInLockedState()) | 151 if (rotation_locked_ && !CanRotateInLockedState()) |
152 return; | 152 return; |
153 if (!update.has(chromeos::ACCELEROMETER_SOURCE_SCREEN)) | 153 if (!update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN)) |
154 return; | 154 return; |
155 // Ignore the reading if it appears unstable. The reading is considered | 155 // Ignore the reading if it appears unstable. The reading is considered |
156 // unstable if it deviates too much from gravity | 156 // unstable if it deviates too much from gravity |
157 if (ui::IsAccelerometerReadingStable(update, | 157 if (ui::IsAccelerometerReadingStable(*update, |
158 chromeos::ACCELEROMETER_SOURCE_SCREEN)) { | 158 chromeos::ACCELEROMETER_SOURCE_SCREEN)) { |
159 HandleScreenRotation(update.get(chromeos::ACCELEROMETER_SOURCE_SCREEN)); | 159 HandleScreenRotation(update->get(chromeos::ACCELEROMETER_SOURCE_SCREEN)); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 bool ScreenOrientationController::FullScreenRequired( | 163 bool ScreenOrientationController::FullScreenRequired( |
164 content::WebContents* web_contents) { | 164 content::WebContents* web_contents) { |
165 return true; | 165 return true; |
166 } | 166 } |
167 | 167 |
168 void ScreenOrientationController::Lock( | 168 void ScreenOrientationController::Lock( |
169 content::WebContents* web_contents, | 169 content::WebContents* web_contents, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 bool ScreenOrientationController::CanRotateInLockedState() { | 415 bool ScreenOrientationController::CanRotateInLockedState() { |
416 return rotation_locked_orientation_ == | 416 return rotation_locked_orientation_ == |
417 blink::WebScreenOrientationLockLandscape || | 417 blink::WebScreenOrientationLockLandscape || |
418 rotation_locked_orientation_ == | 418 rotation_locked_orientation_ == |
419 blink::WebScreenOrientationLockPortrait; | 419 blink::WebScreenOrientationLockPortrait; |
420 } | 420 } |
421 | 421 |
422 } // namespace ash | 422 } // namespace ash |
OLD | NEW |