| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return false; | 363 return false; |
| 364 } | 364 } |
| 365 | 365 |
| 366 bool AcceleratorControllerDelegateAura::CanPerformAction( | 366 bool AcceleratorControllerDelegateAura::CanPerformAction( |
| 367 AcceleratorAction action, | 367 AcceleratorAction action, |
| 368 const ui::Accelerator& accelerator, | 368 const ui::Accelerator& accelerator, |
| 369 const ui::Accelerator& previous_accelerator) { | 369 const ui::Accelerator& previous_accelerator) { |
| 370 switch (action) { | 370 switch (action) { |
| 371 case DEBUG_TOGGLE_WALLPAPER_MODE: | 371 case DEBUG_TOGGLE_WALLPAPER_MODE: |
| 372 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: | 372 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: |
| 373 case DEBUG_TOGGLE_ROOT_WINDOW_FULL_SCREEN: | |
| 374 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: | 373 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: |
| 375 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: | 374 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: |
| 376 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: | 375 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: |
| 377 return debug::DebugAcceleratorsEnabled(); | 376 return debug::DebugAcceleratorsEnabled(); |
| 377 case DEBUG_TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
| 378 return debug::DeveloperAcceleratorsEnabled(); |
| 378 case MAGNIFY_SCREEN_ZOOM_IN: | 379 case MAGNIFY_SCREEN_ZOOM_IN: |
| 379 case MAGNIFY_SCREEN_ZOOM_OUT: | 380 case MAGNIFY_SCREEN_ZOOM_OUT: |
| 380 return CanHandleMagnifyScreen(); | 381 return CanHandleMagnifyScreen(); |
| 381 case SCALE_UI_DOWN: | 382 case SCALE_UI_DOWN: |
| 382 case SCALE_UI_RESET: | 383 case SCALE_UI_RESET: |
| 383 case SCALE_UI_UP: | 384 case SCALE_UI_UP: |
| 384 return accelerators::IsInternalDisplayZoomEnabled(); | 385 return accelerators::IsInternalDisplayZoomEnabled(); |
| 385 case UNPIN: | 386 case UNPIN: |
| 386 return CanHandleUnpin(); | 387 return CanHandleUnpin(); |
| 387 | 388 |
| 388 // Following are always enabled: | 389 // Following are always enabled: |
| 389 case ROTATE_SCREEN: | 390 case ROTATE_SCREEN: |
| 390 case ROTATE_WINDOW: | 391 case ROTATE_WINDOW: |
| 391 case SHOW_SYSTEM_TRAY_BUBBLE: | 392 case SHOW_SYSTEM_TRAY_BUBBLE: |
| 392 case TAKE_PARTIAL_SCREENSHOT: | 393 case TAKE_PARTIAL_SCREENSHOT: |
| 393 case TAKE_SCREENSHOT: | 394 case TAKE_SCREENSHOT: |
| 394 case TAKE_WINDOW_SCREENSHOT: | 395 case TAKE_WINDOW_SCREENSHOT: |
| 395 return true; | 396 return true; |
| 396 | 397 |
| 397 #if defined(OS_CHROMEOS) | 398 #if defined(OS_CHROMEOS) |
| 398 case DEBUG_ADD_REMOVE_DISPLAY: | 399 case DEBUG_ADD_REMOVE_DISPLAY: |
| 399 case DEBUG_TOGGLE_UNIFIED_DESKTOP: | 400 case DEBUG_TOGGLE_UNIFIED_DESKTOP: |
| 400 return debug::DebugAcceleratorsEnabled(); | 401 case TOGGLE_MIRROR_MODE: |
| 402 return debug::DeveloperAcceleratorsEnabled(); |
| 401 | 403 |
| 402 case SWAP_PRIMARY_DISPLAY: | 404 case SWAP_PRIMARY_DISPLAY: |
| 403 return display::Screen::GetScreen()->GetNumDisplays() > 1; | 405 return display::Screen::GetScreen()->GetNumDisplays() > 1; |
| 404 case TOUCH_HUD_CLEAR: | 406 case TOUCH_HUD_CLEAR: |
| 405 case TOUCH_HUD_MODE_CHANGE: | 407 case TOUCH_HUD_MODE_CHANGE: |
| 406 return CanHandleTouchHud(); | 408 return CanHandleTouchHud(); |
| 407 | 409 |
| 408 // Following are always enabled. | 410 // Following are always enabled. |
| 409 case DISABLE_GPU_WATCHDOG: | 411 case DISABLE_GPU_WATCHDOG: |
| 410 case LOCK_PRESSED: | 412 case LOCK_PRESSED: |
| 411 case LOCK_RELEASED: | 413 case LOCK_RELEASED: |
| 412 case POWER_PRESSED: | 414 case POWER_PRESSED: |
| 413 case POWER_RELEASED: | 415 case POWER_RELEASED: |
| 414 case TOGGLE_MIRROR_MODE: | |
| 415 case TOUCH_HUD_PROJECTION_TOGGLE: | 416 case TOUCH_HUD_PROJECTION_TOGGLE: |
| 416 return true; | 417 return true; |
| 417 #endif | 418 #endif |
| 418 | 419 |
| 419 default: | 420 default: |
| 420 NOTREACHED(); | 421 NOTREACHED(); |
| 421 break; | 422 break; |
| 422 } | 423 } |
| 423 return false; | 424 return false; |
| 424 } | 425 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 message_center::NotifierId( | 548 message_center::NotifierId( |
| 548 message_center::NotifierId::SYSTEM_COMPONENT, | 549 message_center::NotifierId::SYSTEM_COMPONENT, |
| 549 system_notifier::kNotifierDeprecatedAccelerator), | 550 system_notifier::kNotifierDeprecatedAccelerator), |
| 550 message_center::RichNotificationData(), | 551 message_center::RichNotificationData(), |
| 551 new DeprecatedAcceleratorNotificationDelegate)); | 552 new DeprecatedAcceleratorNotificationDelegate)); |
| 552 message_center::MessageCenter::Get()->AddNotification( | 553 message_center::MessageCenter::Get()->AddNotification( |
| 553 std::move(notification)); | 554 std::move(notification)); |
| 554 } | 555 } |
| 555 | 556 |
| 556 } // namespace ash | 557 } // namespace ash |
| OLD | NEW |