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/ash_switches.h" | 5 #include "ash/ash_switches.h" |
6 #include "ash/content/display/screen_orientation_controller_chromeos.h" | 6 #include "ash/content/display/screen_orientation_controller_chromeos.h" |
7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 Shell::GetInstance()->display_manager()->SetDisplayRotation( | 65 Shell::GetInstance()->display_manager()->SetDisplayRotation( |
66 gfx::Display::InternalDisplayId(), rotation); | 66 gfx::Display::InternalDisplayId(), rotation); |
67 } | 67 } |
68 | 68 |
69 void SetRotationLocked(bool rotation_locked) { | 69 void SetRotationLocked(bool rotation_locked) { |
70 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( | 70 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( |
71 rotation_locked); | 71 rotation_locked); |
72 } | 72 } |
73 | 73 |
74 void TriggerLidUpdate(const gfx::Vector3dF& lid) { | 74 void TriggerLidUpdate(const gfx::Vector3dF& lid) { |
75 chromeos::AccelerometerUpdate update; | 75 scoped_refptr<chromeos::AccelerometerUpdate> update( |
76 update.Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), lid.z()); | 76 new chromeos::AccelerometerUpdate()); |
| 77 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), lid.z()); |
77 Shell::GetInstance()->screen_orientation_controller()->OnAccelerometerUpdated( | 78 Shell::GetInstance()->screen_orientation_controller()->OnAccelerometerUpdated( |
78 update); | 79 update); |
79 } | 80 } |
80 | 81 |
81 // Attaches the NativeView of |web_contents| to |parent| without changing the | 82 // Attaches the NativeView of |web_contents| to |parent| without changing the |
82 // currently active window. | 83 // currently active window. |
83 void AttachWebContents(content::WebContents* web_contents, | 84 void AttachWebContents(content::WebContents* web_contents, |
84 aura::Window* parent) { | 85 aura::Window* parent) { |
85 aura::Window* window = web_contents->GetNativeView(); | 86 aura::Window* window = web_contents->GetNativeView(); |
86 window->Show(); | 87 window->Show(); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 583 |
583 SetRotationLocked(true); | 584 SetRotationLocked(true); |
584 EXPECT_TRUE(RotationLocked()); | 585 EXPECT_TRUE(RotationLocked()); |
585 EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); | 586 EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
586 | 587 |
587 TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | 588 TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
588 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 589 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
589 } | 590 } |
590 | 591 |
591 } // namespace ash | 592 } // namespace ash |
OLD | NEW |