| 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 <math.h> | 5 #include <math.h> |
| 6 | 6 |
| 7 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 7 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 chromeos::AccelerometerReader::GetInstance()->AddObserver( | 70 chromeos::AccelerometerReader::GetInstance()->AddObserver( |
| 71 maximize_mode_controller()); | 71 maximize_mode_controller()); |
| 72 test::AshTestBase::TearDown(); | 72 test::AshTestBase::TearDown(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 MaximizeModeController* maximize_mode_controller() { | 75 MaximizeModeController* maximize_mode_controller() { |
| 76 return Shell::GetInstance()->maximize_mode_controller(); | 76 return Shell::GetInstance()->maximize_mode_controller(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void TriggerLidUpdate(const gfx::Vector3dF& lid) { | 79 void TriggerLidUpdate(const gfx::Vector3dF& lid) { |
| 80 chromeos::AccelerometerUpdate update; | 80 scoped_refptr<chromeos::AccelerometerUpdate> update( |
| 81 update.Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), | 81 new chromeos::AccelerometerUpdate()); |
| 82 lid.z()); | 82 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), |
| 83 lid.z()); |
| 83 maximize_mode_controller()->OnAccelerometerUpdated(update); | 84 maximize_mode_controller()->OnAccelerometerUpdated(update); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void TriggerBaseAndLidUpdate(const gfx::Vector3dF& base, | 87 void TriggerBaseAndLidUpdate(const gfx::Vector3dF& base, |
| 87 const gfx::Vector3dF& lid) { | 88 const gfx::Vector3dF& lid) { |
| 88 chromeos::AccelerometerUpdate update; | 89 scoped_refptr<chromeos::AccelerometerUpdate> update( |
| 89 update.Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, base.x(), | 90 new chromeos::AccelerometerUpdate()); |
| 90 base.y(), base.z()); | 91 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, base.x(), |
| 91 update.Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), | 92 base.y(), base.z()); |
| 92 lid.z()); | 93 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), |
| 94 lid.z()); |
| 93 maximize_mode_controller()->OnAccelerometerUpdated(update); | 95 maximize_mode_controller()->OnAccelerometerUpdated(update); |
| 94 } | 96 } |
| 95 | 97 |
| 96 bool IsMaximizeModeStarted() { | 98 bool IsMaximizeModeStarted() { |
| 97 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); | 99 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 gfx::Display::Rotation GetInternalDisplayRotation() const { | 102 gfx::Display::Rotation GetInternalDisplayRotation() const { |
| 101 return Shell::GetInstance()->display_manager()->GetDisplayInfo( | 103 return Shell::GetInstance()->display_manager()->GetDisplayInfo( |
| 102 gfx::Display::InternalDisplayId()).rotation(); | 104 gfx::Display::InternalDisplayId()).rotation(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // accelerometer updates which would normally cause it to exit do not. | 385 // accelerometer updates which would normally cause it to exit do not. |
| 384 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 386 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
| 385 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 387 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 386 | 388 |
| 387 // Would normally trigger an exit from maximize mode. | 389 // Would normally trigger an exit from maximize mode. |
| 388 OpenLidToAngle(90.0f); | 390 OpenLidToAngle(90.0f); |
| 389 EXPECT_TRUE(IsMaximizeModeStarted()); | 391 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 390 } | 392 } |
| 391 | 393 |
| 392 } // namespace ash | 394 } // namespace ash |
| OLD | NEW |