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/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/accelerometer/accelerometer_controller.h" | 9 #include "ash/accelerometer/accelerometer_controller.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // attached to the same physical device and so should be under the same | 53 // attached to the same physical device and so should be under the same |
54 // acceleration. | 54 // acceleration. |
55 const float kNoisyMagnitudeDeviation = 0.1f; | 55 const float kNoisyMagnitudeDeviation = 0.1f; |
56 | 56 |
57 // The angle which the screen has to be rotated past before the display will | 57 // The angle which the screen has to be rotated past before the display will |
58 // rotate to match it (i.e. 45.0f is no stickiness). | 58 // rotate to match it (i.e. 45.0f is no stickiness). |
59 const float kDisplayRotationStickyAngleDegrees = 60.0f; | 59 const float kDisplayRotationStickyAngleDegrees = 60.0f; |
60 | 60 |
61 // The minimum acceleration in a direction required to trigger screen rotation. | 61 // The minimum acceleration in a direction required to trigger screen rotation. |
62 // This prevents rapid toggling of rotation when the device is near flat and | 62 // This prevents rapid toggling of rotation when the device is near flat and |
63 // there is very little screen aligned force on it. | 63 // there is very little screen aligned force on it. The value is effectively the |
64 const float kMinimumAccelerationScreenRotation = 0.3f; | 64 // sine of the rise angle required, with the current value requiring at least a |
| 65 // 25 degree rise. |
| 66 const float kMinimumAccelerationScreenRotation = 0.42f; |
65 | 67 |
66 const float kRadiansToDegrees = 180.0f / 3.14159265f; | 68 const float kRadiansToDegrees = 180.0f / 3.14159265f; |
67 | 69 |
68 // Returns the angle between |base| and |other| in degrees. | 70 // Returns the angle between |base| and |other| in degrees. |
69 float AngleBetweenVectorsInDegrees(const gfx::Vector3dF& base, | 71 float AngleBetweenVectorsInDegrees(const gfx::Vector3dF& base, |
70 const gfx::Vector3dF& other) { | 72 const gfx::Vector3dF& other) { |
71 return acos(gfx::DotProduct(base, other) / | 73 return acos(gfx::DotProduct(base, other) / |
72 base.Length() / other.Length()) * kRadiansToDegrees; | 74 base.Length() / other.Length()) * kRadiansToDegrees; |
73 } | 75 } |
74 | 76 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 void MaximizeModeController::SetDisplayRotation( | 306 void MaximizeModeController::SetDisplayRotation( |
305 DisplayManager* display_manager, | 307 DisplayManager* display_manager, |
306 gfx::Display::Rotation rotation) { | 308 gfx::Display::Rotation rotation) { |
307 base::AutoReset<bool> auto_in_set_screen_rotation( | 309 base::AutoReset<bool> auto_in_set_screen_rotation( |
308 &in_set_screen_rotation_, true); | 310 &in_set_screen_rotation_, true); |
309 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 311 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
310 rotation); | 312 rotation); |
311 } | 313 } |
312 | 314 |
313 } // namespace ash | 315 } // namespace ash |
OLD | NEW |