| 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> |
| 11 | 11 |
| 12 #include "ash/accelerators/accelerator_commands_aura.h" | 12 #include "ash/accelerators/accelerator_commands_aura.h" |
| 13 #include "ash/common/accelerators/debug_commands.h" | 13 #include "ash/common/accelerators/debug_commands.h" |
| 14 #include "ash/common/accessibility_types.h" | 14 #include "ash/common/accessibility_types.h" |
| 15 #include "ash/common/session/session_state_delegate.h" | 15 #include "ash/common/session/session_state_delegate.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
| 17 #include "ash/common/shell_delegate.h" | 17 #include "ash/common/shell_delegate.h" |
| 18 #include "ash/common/system/system_notifier.h" | 18 #include "ash/common/system/system_notifier.h" |
| 19 #include "ash/common/system/tray/system_tray.h" | |
| 20 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 19 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 21 #include "ash/common/wm/window_state.h" | 20 #include "ash/common/wm/window_state.h" |
| 22 #include "ash/common/wm/wm_event.h" | 21 #include "ash/common/wm/wm_event.h" |
| 23 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
| 24 #include "ash/debug.h" | 23 #include "ash/debug.h" |
| 25 #include "ash/display/display_configuration_controller.h" | 24 #include "ash/display/display_configuration_controller.h" |
| 26 #include "ash/display/window_tree_host_manager.h" | 25 #include "ash/display/window_tree_host_manager.h" |
| 27 #include "ash/host/ash_window_tree_host.h" | 26 #include "ash/host/ash_window_tree_host.h" |
| 28 #include "ash/magnifier/magnification_controller.h" | 27 #include "ash/magnifier/magnification_controller.h" |
| 29 #include "ash/public/cpp/shell_window_ids.h" | 28 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // right now, queue this animation so when it starts it picks up a neutral | 179 // right now, queue this animation so when it starts it picks up a neutral |
| 181 // rotation and position. Use replace so we only enqueue one at a time. | 180 // rotation and position. Use replace so we only enqueue one at a time. |
| 182 active_window->layer()->GetAnimator()->set_preemption_strategy( | 181 active_window->layer()->GetAnimator()->set_preemption_strategy( |
| 183 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 182 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 184 active_window->layer()->GetAnimator()->StartAnimation( | 183 active_window->layer()->GetAnimator()->StartAnimation( |
| 185 new ui::LayerAnimationSequence( | 184 new ui::LayerAnimationSequence( |
| 186 base::MakeUnique<WindowRotation>(360, active_window->layer()))); | 185 base::MakeUnique<WindowRotation>(360, active_window->layer()))); |
| 187 } | 186 } |
| 188 } | 187 } |
| 189 | 188 |
| 190 void HandleShowSystemTrayBubble() { | |
| 191 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); | |
| 192 RootWindowController* controller = | |
| 193 RootWindowController::ForTargetRootWindow(); | |
| 194 SystemTray* tray = controller->GetSystemTray(); | |
| 195 if (!tray->HasSystemBubble()) { | |
| 196 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | |
| 197 tray->ActivateBubble(); | |
| 198 } | |
| 199 } | |
| 200 | |
| 201 void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { | 189 void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { |
| 202 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); | 190 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); |
| 203 DCHECK(screenshot_delegate); | 191 DCHECK(screenshot_delegate); |
| 204 Shell::GetInstance()->screenshot_controller()->StartWindowScreenshotSession( | 192 Shell::GetInstance()->screenshot_controller()->StartWindowScreenshotSession( |
| 205 screenshot_delegate); | 193 screenshot_delegate); |
| 206 } | 194 } |
| 207 | 195 |
| 208 void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) { | 196 void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) { |
| 209 base::RecordAction(UserMetricsAction("Accel_Take_Partial_Screenshot")); | 197 base::RecordAction(UserMetricsAction("Accel_Take_Partial_Screenshot")); |
| 210 DCHECK(screenshot_delegate); | 198 DCHECK(screenshot_delegate); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 case MAGNIFY_SCREEN_ZOOM_IN: | 275 case MAGNIFY_SCREEN_ZOOM_IN: |
| 288 case MAGNIFY_SCREEN_ZOOM_OUT: | 276 case MAGNIFY_SCREEN_ZOOM_OUT: |
| 289 case POWER_PRESSED: | 277 case POWER_PRESSED: |
| 290 case POWER_RELEASED: | 278 case POWER_RELEASED: |
| 291 case ROTATE_SCREEN: | 279 case ROTATE_SCREEN: |
| 292 case ROTATE_WINDOW: | 280 case ROTATE_WINDOW: |
| 293 case SCALE_UI_DOWN: | 281 case SCALE_UI_DOWN: |
| 294 case SCALE_UI_RESET: | 282 case SCALE_UI_RESET: |
| 295 case SCALE_UI_UP: | 283 case SCALE_UI_UP: |
| 296 case SHOW_MESSAGE_CENTER_BUBBLE: | 284 case SHOW_MESSAGE_CENTER_BUBBLE: |
| 297 case SHOW_SYSTEM_TRAY_BUBBLE: | |
| 298 case SWAP_PRIMARY_DISPLAY: | 285 case SWAP_PRIMARY_DISPLAY: |
| 299 case TAKE_PARTIAL_SCREENSHOT: | 286 case TAKE_PARTIAL_SCREENSHOT: |
| 300 case TAKE_SCREENSHOT: | 287 case TAKE_SCREENSHOT: |
| 301 case TAKE_WINDOW_SCREENSHOT: | 288 case TAKE_WINDOW_SCREENSHOT: |
| 302 case TOGGLE_MIRROR_MODE: | 289 case TOGGLE_MIRROR_MODE: |
| 303 case TOUCH_HUD_CLEAR: | 290 case TOUCH_HUD_CLEAR: |
| 304 case TOUCH_HUD_MODE_CHANGE: | 291 case TOUCH_HUD_MODE_CHANGE: |
| 305 case TOUCH_HUD_PROJECTION_TOGGLE: | 292 case TOUCH_HUD_PROJECTION_TOGGLE: |
| 306 case UNPIN: | 293 case UNPIN: |
| 307 return true; | 294 return true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 336 case UNPIN: | 323 case UNPIN: |
| 337 return CanHandleUnpin(); | 324 return CanHandleUnpin(); |
| 338 | 325 |
| 339 // Following are always enabled: | 326 // Following are always enabled: |
| 340 case LOCK_PRESSED: | 327 case LOCK_PRESSED: |
| 341 case LOCK_RELEASED: | 328 case LOCK_RELEASED: |
| 342 case POWER_PRESSED: | 329 case POWER_PRESSED: |
| 343 case POWER_RELEASED: | 330 case POWER_RELEASED: |
| 344 case ROTATE_SCREEN: | 331 case ROTATE_SCREEN: |
| 345 case ROTATE_WINDOW: | 332 case ROTATE_WINDOW: |
| 346 case SHOW_SYSTEM_TRAY_BUBBLE: | |
| 347 case TAKE_PARTIAL_SCREENSHOT: | 333 case TAKE_PARTIAL_SCREENSHOT: |
| 348 case TAKE_SCREENSHOT: | 334 case TAKE_SCREENSHOT: |
| 349 case TAKE_WINDOW_SCREENSHOT: | 335 case TAKE_WINDOW_SCREENSHOT: |
| 350 case TOGGLE_MIRROR_MODE: | 336 case TOGGLE_MIRROR_MODE: |
| 351 case TOUCH_HUD_PROJECTION_TOGGLE: | 337 case TOUCH_HUD_PROJECTION_TOGGLE: |
| 352 return true; | 338 return true; |
| 353 | 339 |
| 354 case SWAP_PRIMARY_DISPLAY: | 340 case SWAP_PRIMARY_DISPLAY: |
| 355 return display::Screen::GetScreen()->GetNumDisplays() > 1; | 341 return display::Screen::GetScreen()->GetNumDisplays() > 1; |
| 356 case TOUCH_HUD_CLEAR: | 342 case TOUCH_HUD_CLEAR: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 break; | 408 break; |
| 423 case SCALE_UI_DOWN: | 409 case SCALE_UI_DOWN: |
| 424 accelerators::ZoomInternalDisplay(false /* down */); | 410 accelerators::ZoomInternalDisplay(false /* down */); |
| 425 break; | 411 break; |
| 426 case SCALE_UI_RESET: | 412 case SCALE_UI_RESET: |
| 427 accelerators::ResetInternalDisplayZoom(); | 413 accelerators::ResetInternalDisplayZoom(); |
| 428 break; | 414 break; |
| 429 case SCALE_UI_UP: | 415 case SCALE_UI_UP: |
| 430 accelerators::ZoomInternalDisplay(true /* up */); | 416 accelerators::ZoomInternalDisplay(true /* up */); |
| 431 break; | 417 break; |
| 432 case SHOW_SYSTEM_TRAY_BUBBLE: | |
| 433 HandleShowSystemTrayBubble(); | |
| 434 break; | |
| 435 case SWAP_PRIMARY_DISPLAY: | 418 case SWAP_PRIMARY_DISPLAY: |
| 436 HandleSwapPrimaryDisplay(); | 419 HandleSwapPrimaryDisplay(); |
| 437 break; | 420 break; |
| 438 case TAKE_PARTIAL_SCREENSHOT: | 421 case TAKE_PARTIAL_SCREENSHOT: |
| 439 HandleTakePartialScreenshot(screenshot_delegate_.get()); | 422 HandleTakePartialScreenshot(screenshot_delegate_.get()); |
| 440 break; | 423 break; |
| 441 case TAKE_SCREENSHOT: | 424 case TAKE_SCREENSHOT: |
| 442 HandleTakeScreenshot(screenshot_delegate_.get()); | 425 HandleTakeScreenshot(screenshot_delegate_.get()); |
| 443 break; | 426 break; |
| 444 case TAKE_WINDOW_SCREENSHOT: | 427 case TAKE_WINDOW_SCREENSHOT: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 message_center::NotifierId( | 463 message_center::NotifierId( |
| 481 message_center::NotifierId::SYSTEM_COMPONENT, | 464 message_center::NotifierId::SYSTEM_COMPONENT, |
| 482 system_notifier::kNotifierDeprecatedAccelerator), | 465 system_notifier::kNotifierDeprecatedAccelerator), |
| 483 message_center::RichNotificationData(), | 466 message_center::RichNotificationData(), |
| 484 new DeprecatedAcceleratorNotificationDelegate)); | 467 new DeprecatedAcceleratorNotificationDelegate)); |
| 485 message_center::MessageCenter::Get()->AddNotification( | 468 message_center::MessageCenter::Get()->AddNotification( |
| 486 std::move(notification)); | 469 std::move(notification)); |
| 487 } | 470 } |
| 488 | 471 |
| 489 } // namespace ash | 472 } // namespace ash |
| OLD | NEW |