OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/accelerators/accelerator_controller_delegate_aura.h" | 5 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "ash/common/wm/window_state.h" | 21 #include "ash/common/wm/window_state.h" |
22 #include "ash/common/wm/wm_event.h" | 22 #include "ash/common/wm/wm_event.h" |
23 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
24 #include "ash/debug.h" | 24 #include "ash/debug.h" |
25 #include "ash/display/display_configuration_controller.h" | 25 #include "ash/display/display_configuration_controller.h" |
26 #include "ash/display/window_tree_host_manager.h" | 26 #include "ash/display/window_tree_host_manager.h" |
27 #include "ash/host/ash_window_tree_host.h" | 27 #include "ash/host/ash_window_tree_host.h" |
28 #include "ash/magnifier/magnification_controller.h" | 28 #include "ash/magnifier/magnification_controller.h" |
29 #include "ash/public/cpp/shell_window_ids.h" | 29 #include "ash/public/cpp/shell_window_ids.h" |
30 #include "ash/root_window_controller.h" | 30 #include "ash/root_window_controller.h" |
31 #include "ash/rotator/screen_rotation_animator.h" | |
32 #include "ash/rotator/window_rotation.h" | 31 #include "ash/rotator/window_rotation.h" |
33 #include "ash/screenshot_delegate.h" | 32 #include "ash/screenshot_delegate.h" |
34 #include "ash/shell.h" | 33 #include "ash/shell.h" |
35 #include "ash/touch/touch_hud_debug.h" | 34 #include "ash/touch/touch_hud_debug.h" |
36 #include "ash/utility/screenshot_controller.h" | 35 #include "ash/utility/screenshot_controller.h" |
37 #include "ash/wm/power_button_controller.h" | 36 #include "ash/wm/power_button_controller.h" |
38 #include "ash/wm/window_state_aura.h" | 37 #include "ash/wm/window_state_aura.h" |
39 #include "ash/wm/window_util.h" | 38 #include "ash/wm/window_util.h" |
40 #include "base/memory/ptr_util.h" | 39 #include "base/memory/ptr_util.h" |
41 #include "base/metrics/histogram_macros.h" | 40 #include "base/metrics/histogram_macros.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 } | 152 } |
154 NOTREACHED() << "Unknown rotation:" << current; | 153 NOTREACHED() << "Unknown rotation:" << current; |
155 return display::Display::ROTATE_0; | 154 return display::Display::ROTATE_0; |
156 } | 155 } |
157 | 156 |
158 // Rotates the screen. | 157 // Rotates the screen. |
159 void HandleRotateScreen() { | 158 void HandleRotateScreen() { |
160 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) | 159 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) |
161 return; | 160 return; |
162 | 161 |
163 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 162 base::RecordAction(UserMetricsAction("Accel_Rotate_Screen")); |
bruthig
2017/02/28 22:49:22
Good eye!
| |
164 gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); | 163 gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); |
165 display::Display display = | 164 display::Display display = |
166 display::Screen::GetScreen()->GetDisplayNearestPoint(point); | 165 display::Screen::GetScreen()->GetDisplayNearestPoint(point); |
167 const display::ManagedDisplayInfo& display_info = | 166 const display::ManagedDisplayInfo& display_info = |
168 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); | 167 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); |
169 ScreenRotationAnimator(display.id()) | 168 Shell::GetInstance()->display_configuration_controller()->SetDisplayRotation( |
170 .Rotate(GetNextRotation(display_info.GetActiveRotation()), | 169 display.id(), GetNextRotation(display_info.GetActiveRotation()), |
171 display::Display::ROTATION_SOURCE_USER); | 170 display::Display::ROTATION_SOURCE_USER); |
172 } | 171 } |
173 | 172 |
174 // Rotate the active window. | 173 // Rotate the active window. |
175 void HandleRotateActiveWindow() { | 174 void HandleRotateActiveWindow() { |
176 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 175 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); |
177 aura::Window* active_window = wm::GetActiveWindow(); | 176 aura::Window* active_window = wm::GetActiveWindow(); |
178 if (active_window) { | 177 if (active_window) { |
179 // The rotation animation bases its target transform on the current | 178 // The rotation animation bases its target transform on the current |
180 // rotation and position. Since there could be an animation in progress | 179 // rotation and position. Since there could be an animation in progress |
181 // right now, queue this animation so when it starts it picks up a neutral | 180 // right now, queue this animation so when it starts it picks up a neutral |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 message_center::NotifierId( | 480 message_center::NotifierId( |
482 message_center::NotifierId::SYSTEM_COMPONENT, | 481 message_center::NotifierId::SYSTEM_COMPONENT, |
483 system_notifier::kNotifierDeprecatedAccelerator), | 482 system_notifier::kNotifierDeprecatedAccelerator), |
484 message_center::RichNotificationData(), | 483 message_center::RichNotificationData(), |
485 new DeprecatedAcceleratorNotificationDelegate)); | 484 new DeprecatedAcceleratorNotificationDelegate)); |
486 message_center::MessageCenter::Get()->AddNotification( | 485 message_center::MessageCenter::Get()->AddNotification( |
487 std::move(notification)); | 486 std::move(notification)); |
488 } | 487 } |
489 | 488 |
490 } // namespace ash | 489 } // namespace ash |
OLD | NEW |