| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "ash/accelerators/accelerator_controller.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // help page when the notification is clicked. | 98 // help page when the notification is clicked. |
| 99 class DeprecatedAcceleratorNotificationDelegate | 99 class DeprecatedAcceleratorNotificationDelegate |
| 100 : public message_center::NotificationDelegate { | 100 : public message_center::NotificationDelegate { |
| 101 public: | 101 public: |
| 102 DeprecatedAcceleratorNotificationDelegate() {} | 102 DeprecatedAcceleratorNotificationDelegate() {} |
| 103 | 103 |
| 104 // message_center::NotificationDelegate: | 104 // message_center::NotificationDelegate: |
| 105 bool HasClickedListener() override { return true; } | 105 bool HasClickedListener() override { return true; } |
| 106 | 106 |
| 107 void Click() override { | 107 void Click() override { |
| 108 if (!Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) | 108 if (!WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()) |
| 109 Shell::GetInstance()->delegate()->OpenKeyboardShortcutHelpPage(); | 109 Shell::GetInstance()->delegate()->OpenKeyboardShortcutHelpPage(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 // Private destructor since NotificationDelegate is ref-counted. | 113 // Private destructor since NotificationDelegate is ref-counted. |
| 114 ~DeprecatedAcceleratorNotificationDelegate() override {} | 114 ~DeprecatedAcceleratorNotificationDelegate() override {} |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(DeprecatedAcceleratorNotificationDelegate); | 116 DISALLOW_COPY_AND_ASSIGN(DeprecatedAcceleratorNotificationDelegate); |
| 117 }; | 117 }; |
| 118 | 118 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool CanHandleMagnifyScreen() { | 240 bool CanHandleMagnifyScreen() { |
| 241 Shell* shell = Shell::GetInstance(); | 241 Shell* shell = Shell::GetInstance(); |
| 242 return shell->magnification_controller()->IsEnabled() || | 242 return shell->magnification_controller()->IsEnabled() || |
| 243 shell->partial_magnification_controller()->is_enabled(); | 243 shell->partial_magnification_controller()->is_enabled(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Magnify the screen | 246 // Magnify the screen |
| 247 void HandleMagnifyScreen(int delta_index) { | 247 void HandleMagnifyScreen(int delta_index) { |
| 248 if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) { | 248 if (Shell::GetInstance()->magnification_controller()->IsEnabled()) { |
| 249 // TODO(yoshiki): Move the following logic to MagnificationController. | 249 // TODO(yoshiki): Move the following logic to MagnificationController. |
| 250 float scale = | 250 float scale = Shell::GetInstance()->magnification_controller()->GetScale(); |
| 251 ash::Shell::GetInstance()->magnification_controller()->GetScale(); | |
| 252 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. | 251 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. |
| 253 int scale_index = | 252 int scale_index = |
| 254 std::floor(std::log(scale) / std::log(kMagnificationScaleFactor) + 0.5); | 253 std::floor(std::log(scale) / std::log(kMagnificationScaleFactor) + 0.5); |
| 255 | 254 |
| 256 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); | 255 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); |
| 257 | 256 |
| 258 ash::Shell::GetInstance()->magnification_controller()->SetScale( | 257 Shell::GetInstance()->magnification_controller()->SetScale( |
| 259 std::pow(kMagnificationScaleFactor, new_scale_index), true); | 258 std::pow(kMagnificationScaleFactor, new_scale_index), true); |
| 260 } else if (ash::Shell::GetInstance() | 259 } else if (Shell::GetInstance() |
| 261 ->partial_magnification_controller() | 260 ->partial_magnification_controller() |
| 262 ->is_enabled()) { | 261 ->is_enabled()) { |
| 263 float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1; | 262 float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1; |
| 264 ash::Shell::GetInstance()->partial_magnification_controller()->SetScale( | 263 Shell::GetInstance()->partial_magnification_controller()->SetScale(scale); |
| 265 scale); | |
| 266 } | 264 } |
| 267 } | 265 } |
| 268 | 266 |
| 269 void HandleMediaNextTrack() { | 267 void HandleMediaNextTrack() { |
| 270 Shell::GetInstance()->media_delegate()->HandleMediaNextTrack(); | 268 Shell::GetInstance()->media_delegate()->HandleMediaNextTrack(); |
| 271 } | 269 } |
| 272 | 270 |
| 273 void HandleMediaPlayPause() { | 271 void HandleMediaPlayPause() { |
| 274 Shell::GetInstance()->media_delegate()->HandleMediaPlayPause(); | 272 Shell::GetInstance()->media_delegate()->HandleMediaPlayPause(); |
| 275 } | 273 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 322 } |
| 325 } | 323 } |
| 326 | 324 |
| 327 void HandleNextIme(ImeControlDelegate* ime_control_delegate) { | 325 void HandleNextIme(ImeControlDelegate* ime_control_delegate) { |
| 328 base::RecordAction(UserMetricsAction("Accel_Next_Ime")); | 326 base::RecordAction(UserMetricsAction("Accel_Next_Ime")); |
| 329 ime_control_delegate->HandleNextIme(); | 327 ime_control_delegate->HandleNextIme(); |
| 330 } | 328 } |
| 331 | 329 |
| 332 void HandleOpenFeedbackPage() { | 330 void HandleOpenFeedbackPage() { |
| 333 base::RecordAction(UserMetricsAction("Accel_Open_Feedback_Page")); | 331 base::RecordAction(UserMetricsAction("Accel_Open_Feedback_Page")); |
| 334 ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage(); | 332 Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage(); |
| 335 } | 333 } |
| 336 | 334 |
| 337 bool CanHandlePreviousIme(ImeControlDelegate* ime_control_delegate) { | 335 bool CanHandlePreviousIme(ImeControlDelegate* ime_control_delegate) { |
| 338 return ime_control_delegate && ime_control_delegate->CanCycleIme(); | 336 return ime_control_delegate && ime_control_delegate->CanCycleIme(); |
| 339 } | 337 } |
| 340 | 338 |
| 341 void HandlePreviousIme(ImeControlDelegate* ime_control_delegate, | 339 void HandlePreviousIme(ImeControlDelegate* ime_control_delegate, |
| 342 const ui::Accelerator& accelerator) { | 340 const ui::Accelerator& accelerator) { |
| 343 base::RecordAction(UserMetricsAction("Accel_Previous_Ime")); | 341 base::RecordAction(UserMetricsAction("Accel_Previous_Ime")); |
| 344 if (accelerator.type() == ui::ET_KEY_PRESSED) | 342 if (accelerator.type() == ui::ET_KEY_PRESSED) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 370 void HandleRotateScreen() { | 368 void HandleRotateScreen() { |
| 371 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) | 369 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) |
| 372 return; | 370 return; |
| 373 | 371 |
| 374 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 372 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); |
| 375 gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); | 373 gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 376 display::Display display = | 374 display::Display display = |
| 377 display::Screen::GetScreen()->GetDisplayNearestPoint(point); | 375 display::Screen::GetScreen()->GetDisplayNearestPoint(point); |
| 378 const DisplayInfo& display_info = | 376 const DisplayInfo& display_info = |
| 379 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); | 377 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); |
| 380 ash::ScreenRotationAnimator(display.id()) | 378 ScreenRotationAnimator(display.id()) |
| 381 .Rotate(GetNextRotation(display_info.GetActiveRotation()), | 379 .Rotate(GetNextRotation(display_info.GetActiveRotation()), |
| 382 display::Display::ROTATION_SOURCE_USER); | 380 display::Display::ROTATION_SOURCE_USER); |
| 383 } | 381 } |
| 384 | 382 |
| 385 // Rotate the active window. | 383 // Rotate the active window. |
| 386 void HandleRotateActiveWindow() { | 384 void HandleRotateActiveWindow() { |
| 387 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 385 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); |
| 388 aura::Window* active_window = wm::GetActiveWindow(); | 386 aura::Window* active_window = wm::GetActiveWindow(); |
| 389 if (active_window) { | 387 if (active_window) { |
| 390 // The rotation animation bases its target transform on the current | 388 // The rotation animation bases its target transform on the current |
| 391 // rotation and position. Since there could be an animation in progress | 389 // rotation and position. Since there could be an animation in progress |
| 392 // right now, queue this animation so when it starts it picks up a neutral | 390 // right now, queue this animation so when it starts it picks up a neutral |
| 393 // rotation and position. Use replace so we only enqueue one at a time. | 391 // rotation and position. Use replace so we only enqueue one at a time. |
| 394 active_window->layer()->GetAnimator()->set_preemption_strategy( | 392 active_window->layer()->GetAnimator()->set_preemption_strategy( |
| 395 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 393 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 396 active_window->layer()->GetAnimator()->StartAnimation( | 394 active_window->layer()->GetAnimator()->StartAnimation( |
| 397 new ui::LayerAnimationSequence( | 395 new ui::LayerAnimationSequence( |
| 398 new ash::WindowRotation(360, active_window->layer()))); | 396 new WindowRotation(360, active_window->layer()))); |
| 399 } | 397 } |
| 400 } | 398 } |
| 401 | 399 |
| 402 void HandleShowKeyboardOverlay() { | 400 void HandleShowKeyboardOverlay() { |
| 403 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); | 401 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| 404 ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); | 402 Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); |
| 405 } | 403 } |
| 406 | 404 |
| 407 bool CanHandleShowMessageCenterBubble() { | 405 bool CanHandleShowMessageCenterBubble() { |
| 408 RootWindowController* controller = | 406 RootWindowController* controller = |
| 409 RootWindowController::ForTargetRootWindow(); | 407 RootWindowController::ForTargetRootWindow(); |
| 410 StatusAreaWidget* status_area_widget = | 408 StatusAreaWidget* status_area_widget = |
| 411 controller->shelf_widget()->status_area_widget(); | 409 controller->shelf_widget()->status_area_widget(); |
| 412 return status_area_widget && | 410 return status_area_widget && |
| 413 status_area_widget->web_notification_tray()->visible(); | 411 status_area_widget->web_notification_tray()->visible(); |
| 414 } | 412 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // being pressed and released, then ignore the release of the | 478 // being pressed and released, then ignore the release of the |
| 481 // Search key. | 479 // Search key. |
| 482 if (previous_accelerator.type() != ui::ET_KEY_PRESSED || | 480 if (previous_accelerator.type() != ui::ET_KEY_PRESSED || |
| 483 previous_accelerator.key_code() != ui::VKEY_LWIN) { | 481 previous_accelerator.key_code() != ui::VKEY_LWIN) { |
| 484 return false; | 482 return false; |
| 485 } | 483 } |
| 486 | 484 |
| 487 // When spoken feedback is enabled, we should neither toggle the list nor | 485 // When spoken feedback is enabled, we should neither toggle the list nor |
| 488 // consume the key since Search+Shift is one of the shortcuts the a11y | 486 // consume the key since Search+Shift is one of the shortcuts the a11y |
| 489 // feature uses. crbug.com/132296 | 487 // feature uses. crbug.com/132296 |
| 490 if (Shell::GetInstance() | 488 if (WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled()) |
| 491 ->accessibility_delegate() | |
| 492 ->IsSpokenFeedbackEnabled()) { | |
| 493 return false; | 489 return false; |
| 494 } | |
| 495 } | 490 } |
| 496 return true; | 491 return true; |
| 497 } | 492 } |
| 498 | 493 |
| 499 void HandleToggleAppList(const ui::Accelerator& accelerator) { | 494 void HandleToggleAppList(const ui::Accelerator& accelerator) { |
| 500 if (accelerator.key_code() == ui::VKEY_LWIN) | 495 if (accelerator.key_code() == ui::VKEY_LWIN) |
| 501 base::RecordAction(base::UserMetricsAction("Accel_Search_LWin")); | 496 base::RecordAction(base::UserMetricsAction("Accel_Search_LWin")); |
| 502 ash::Shell::GetInstance()->ToggleAppList(NULL); | 497 Shell::GetInstance()->ToggleAppList(NULL); |
| 503 } | 498 } |
| 504 | 499 |
| 505 void HandleToggleFullscreen(const ui::Accelerator& accelerator) { | 500 void HandleToggleFullscreen(const ui::Accelerator& accelerator) { |
| 506 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2) | 501 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2) |
| 507 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); | 502 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); |
| 508 accelerators::ToggleFullscreen(); | 503 accelerators::ToggleFullscreen(); |
| 509 } | 504 } |
| 510 | 505 |
| 511 void HandleToggleOverview() { | 506 void HandleToggleOverview() { |
| 512 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5")); | 507 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5")); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 delegate->HandleKeyboardBrightnessDown(accelerator); | 596 delegate->HandleKeyboardBrightnessDown(accelerator); |
| 602 } | 597 } |
| 603 | 598 |
| 604 void HandleKeyboardBrightnessUp(KeyboardBrightnessControlDelegate* delegate, | 599 void HandleKeyboardBrightnessUp(KeyboardBrightnessControlDelegate* delegate, |
| 605 const ui::Accelerator& accelerator) { | 600 const ui::Accelerator& accelerator) { |
| 606 if (delegate) | 601 if (delegate) |
| 607 delegate->HandleKeyboardBrightnessUp(accelerator); | 602 delegate->HandleKeyboardBrightnessUp(accelerator); |
| 608 } | 603 } |
| 609 | 604 |
| 610 bool CanHandleLock() { | 605 bool CanHandleLock() { |
| 611 return Shell::GetInstance()->session_state_delegate()->CanLockScreen(); | 606 return WmShell::Get()->GetSessionStateDelegate()->CanLockScreen(); |
| 612 } | 607 } |
| 613 | 608 |
| 614 void HandleLock() { | 609 void HandleLock() { |
| 615 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); | 610 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); |
| 616 Shell::GetInstance()->session_state_delegate()->LockScreen(); | 611 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); |
| 617 } | 612 } |
| 618 | 613 |
| 619 void HandleSuspend() { | 614 void HandleSuspend() { |
| 620 base::RecordAction(UserMetricsAction("Accel_Suspend")); | 615 base::RecordAction(UserMetricsAction("Accel_Suspend")); |
| 621 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); | 616 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); |
| 622 } | 617 } |
| 623 | 618 |
| 624 void HandleCrosh() { | 619 void HandleCrosh() { |
| 625 base::RecordAction(UserMetricsAction("Accel_Open_Crosh")); | 620 base::RecordAction(UserMetricsAction("Accel_Open_Crosh")); |
| 626 | 621 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 639 | 634 |
| 640 void HandleSwapPrimaryDisplay() { | 635 void HandleSwapPrimaryDisplay() { |
| 641 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); | 636 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); |
| 642 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( | 637 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( |
| 643 ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); | 638 ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); |
| 644 } | 639 } |
| 645 | 640 |
| 646 bool CanHandleCycleUser() { | 641 bool CanHandleCycleUser() { |
| 647 Shell* shell = Shell::GetInstance(); | 642 Shell* shell = Shell::GetInstance(); |
| 648 return shell->delegate()->IsMultiProfilesEnabled() && | 643 return shell->delegate()->IsMultiProfilesEnabled() && |
| 649 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; | 644 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; |
| 650 } | 645 } |
| 651 | 646 |
| 652 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { | 647 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { |
| 653 MultiProfileUMA::RecordSwitchActiveUser( | 648 MultiProfileUMA::RecordSwitchActiveUser( |
| 654 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR); | 649 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR); |
| 655 switch (cycle_user) { | 650 switch (cycle_user) { |
| 656 case SessionStateDelegate::CYCLE_TO_NEXT_USER: | 651 case SessionStateDelegate::CYCLE_TO_NEXT_USER: |
| 657 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User")); | 652 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User")); |
| 658 break; | 653 break; |
| 659 case SessionStateDelegate::CYCLE_TO_PREVIOUS_USER: | 654 case SessionStateDelegate::CYCLE_TO_PREVIOUS_USER: |
| 660 base::RecordAction(UserMetricsAction("Accel_Switch_To_Previous_User")); | 655 base::RecordAction(UserMetricsAction("Accel_Switch_To_Previous_User")); |
| 661 break; | 656 break; |
| 662 } | 657 } |
| 663 Shell::GetInstance()->session_state_delegate()->CycleActiveUser(cycle_user); | 658 WmShell::Get()->GetSessionStateDelegate()->CycleActiveUser(cycle_user); |
| 664 } | 659 } |
| 665 | 660 |
| 666 bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator, | 661 bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator, |
| 667 const ui::Accelerator& previous_accelerator) { | 662 const ui::Accelerator& previous_accelerator) { |
| 668 if (accelerator.key_code() == ui::VKEY_LWIN) { | 663 if (accelerator.key_code() == ui::VKEY_LWIN) { |
| 669 // If something else was pressed between the Search key (LWIN) | 664 // If something else was pressed between the Search key (LWIN) |
| 670 // being pressed and released, then ignore the release of the | 665 // being pressed and released, then ignore the release of the |
| 671 // Search key. | 666 // Search key. |
| 672 // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495 | 667 // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495 |
| 673 if (previous_accelerator.type() == ui::ET_KEY_RELEASED || | 668 if (previous_accelerator.type() == ui::ET_KEY_RELEASED || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 690 void HandleToggleMirrorMode() { | 685 void HandleToggleMirrorMode() { |
| 691 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); | 686 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
| 692 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); | 687 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); |
| 693 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( | 688 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( |
| 694 mirror, true /* user_action */); | 689 mirror, true /* user_action */); |
| 695 } | 690 } |
| 696 | 691 |
| 697 void HandleToggleSpokenFeedback() { | 692 void HandleToggleSpokenFeedback() { |
| 698 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); | 693 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
| 699 | 694 |
| 700 Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback( | 695 WmShell::Get()->GetAccessibilityDelegate()->ToggleSpokenFeedback( |
| 701 A11Y_NOTIFICATION_SHOW); | 696 A11Y_NOTIFICATION_SHOW); |
| 702 } | 697 } |
| 703 | 698 |
| 704 bool CanHandleTouchHud() { | 699 bool CanHandleTouchHud() { |
| 705 return RootWindowController::ForTargetRootWindow()->touch_hud_debug(); | 700 return RootWindowController::ForTargetRootWindow()->touch_hud_debug(); |
| 706 } | 701 } |
| 707 | 702 |
| 708 void HandleTouchHudClear() { | 703 void HandleTouchHudClear() { |
| 709 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear(); | 704 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear(); |
| 710 } | 705 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 return true; | 1397 return true; |
| 1403 } | 1398 } |
| 1404 | 1399 |
| 1405 AcceleratorController::AcceleratorProcessingRestriction | 1400 AcceleratorController::AcceleratorProcessingRestriction |
| 1406 AcceleratorController::GetAcceleratorProcessingRestriction(int action) { | 1401 AcceleratorController::GetAcceleratorProcessingRestriction(int action) { |
| 1407 if (WmShell::Get()->IsPinned() && | 1402 if (WmShell::Get()->IsPinned() && |
| 1408 actions_allowed_in_pinned_mode_.find(action) == | 1403 actions_allowed_in_pinned_mode_.find(action) == |
| 1409 actions_allowed_in_pinned_mode_.end()) { | 1404 actions_allowed_in_pinned_mode_.end()) { |
| 1410 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1405 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1411 } | 1406 } |
| 1412 ash::Shell* shell = ash::Shell::GetInstance(); | 1407 Shell* shell = Shell::GetInstance(); |
| 1413 if (!shell->session_state_delegate()->IsActiveUserSessionStarted() && | 1408 WmShell* wm_shell = WmShell::Get(); |
| 1409 if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() && |
| 1414 actions_allowed_at_login_screen_.find(action) == | 1410 actions_allowed_at_login_screen_.find(action) == |
| 1415 actions_allowed_at_login_screen_.end()) { | 1411 actions_allowed_at_login_screen_.end()) { |
| 1416 return RESTRICTION_PREVENT_PROCESSING; | 1412 return RESTRICTION_PREVENT_PROCESSING; |
| 1417 } | 1413 } |
| 1418 if (shell->session_state_delegate()->IsScreenLocked() && | 1414 if (wm_shell->GetSessionStateDelegate()->IsScreenLocked() && |
| 1419 actions_allowed_at_lock_screen_.find(action) == | 1415 actions_allowed_at_lock_screen_.find(action) == |
| 1420 actions_allowed_at_lock_screen_.end()) { | 1416 actions_allowed_at_lock_screen_.end()) { |
| 1421 return RESTRICTION_PREVENT_PROCESSING; | 1417 return RESTRICTION_PREVENT_PROCESSING; |
| 1422 } | 1418 } |
| 1423 if (shell->delegate()->IsRunningInForcedAppMode() && | 1419 if (shell->delegate()->IsRunningInForcedAppMode() && |
| 1424 actions_allowed_in_app_mode_.find(action) == | 1420 actions_allowed_in_app_mode_.find(action) == |
| 1425 actions_allowed_in_app_mode_.end()) { | 1421 actions_allowed_in_app_mode_.end()) { |
| 1426 return RESTRICTION_PREVENT_PROCESSING; | 1422 return RESTRICTION_PREVENT_PROCESSING; |
| 1427 } | 1423 } |
| 1428 if (WmShell::Get()->IsSystemModalWindowOpen() && | 1424 if (WmShell::Get()->IsSystemModalWindowOpen() && |
| 1429 actions_allowed_at_modal_window_.find(action) == | 1425 actions_allowed_at_modal_window_.find(action) == |
| 1430 actions_allowed_at_modal_window_.end()) { | 1426 actions_allowed_at_modal_window_.end()) { |
| 1431 // Note we prevent the shortcut from propagating so it will not | 1427 // Note we prevent the shortcut from propagating so it will not |
| 1432 // be passed to the modal window. This is important for things like | 1428 // be passed to the modal window. This is important for things like |
| 1433 // Alt+Tab that would cause an undesired effect in the modal window by | 1429 // Alt+Tab that would cause an undesired effect in the modal window by |
| 1434 // cycling through its window elements. | 1430 // cycling through its window elements. |
| 1435 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1431 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1436 } | 1432 } |
| 1437 if (shell->mru_window_tracker()->BuildMruWindowList().empty() && | 1433 if (shell->mru_window_tracker()->BuildMruWindowList().empty() && |
| 1438 actions_needing_window_.find(action) != actions_needing_window_.end()) { | 1434 actions_needing_window_.find(action) != actions_needing_window_.end()) { |
| 1439 Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( | 1435 wm_shell->GetAccessibilityDelegate()->TriggerAccessibilityAlert( |
| 1440 A11Y_ALERT_WINDOW_NEEDED); | 1436 A11Y_ALERT_WINDOW_NEEDED); |
| 1441 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1437 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1442 } | 1438 } |
| 1443 return RESTRICTION_NONE; | 1439 return RESTRICTION_NONE; |
| 1444 } | 1440 } |
| 1445 | 1441 |
| 1446 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1442 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1447 std::unique_ptr<KeyboardBrightnessControlDelegate> | 1443 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 1448 keyboard_brightness_control_delegate) { | 1444 keyboard_brightness_control_delegate) { |
| 1449 keyboard_brightness_control_delegate_ = | 1445 keyboard_brightness_control_delegate_ = |
| 1450 std::move(keyboard_brightness_control_delegate); | 1446 std::move(keyboard_brightness_control_delegate); |
| 1451 } | 1447 } |
| 1452 | 1448 |
| 1453 } // namespace ash | 1449 } // namespace ash |
| OLD | NEW |