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 <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool HandleCycleWindowMRU(WindowCycleController::Direction direction, | 88 bool HandleCycleWindowMRU(WindowCycleController::Direction direction, |
89 bool is_alt_down) { | 89 bool is_alt_down) { |
90 Shell::GetInstance()-> | 90 Shell::GetInstance()-> |
91 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down); | 91 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down); |
92 // Always report we handled the key, even if the window didn't change. | 92 // Always report we handled the key, even if the window didn't change. |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 void HandleCycleWindowLinear(CycleDirection direction) { | 96 void HandleCycleWindowLinear(CycleDirection direction) { |
97 Shell::GetInstance()-> | 97 Shell::GetInstance()-> |
98 window_cycle_controller()->HandleLinearCycleWindow(); | 98 window_cycle_controller()->HandleLinearCycleWindow(); |
| 99 } |
| 100 |
| 101 void ToggleOverviewMode() { |
| 102 Shell::GetInstance()->window_cycle_controller()->ToggleOverview(); |
99 } | 103 } |
100 | 104 |
101 bool HandleAccessibleFocusCycle(bool reverse) { | 105 bool HandleAccessibleFocusCycle(bool reverse) { |
102 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) | 106 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) |
103 return false; | 107 return false; |
104 aura::Window* active_window = ash::wm::GetActiveWindow(); | 108 aura::Window* active_window = ash::wm::GetActiveWindow(); |
105 if (!active_window) | 109 if (!active_window) |
106 return false; | 110 return false; |
107 views::Widget* widget = | 111 views::Widget* widget = |
108 views::Widget::GetWidgetForNativeWindow(active_window); | 112 views::Widget::GetWidgetForNativeWindow(active_window); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 if (key_code == ui::VKEY_TAB) | 518 if (key_code == ui::VKEY_TAB) |
515 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); | 519 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); |
516 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, | 520 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, |
517 accelerator.IsAltDown()); | 521 accelerator.IsAltDown()); |
518 case CYCLE_FORWARD_MRU: | 522 case CYCLE_FORWARD_MRU: |
519 if (key_code == ui::VKEY_TAB) | 523 if (key_code == ui::VKEY_TAB) |
520 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); | 524 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); |
521 return HandleCycleWindowMRU(WindowCycleController::FORWARD, | 525 return HandleCycleWindowMRU(WindowCycleController::FORWARD, |
522 accelerator.IsAltDown()); | 526 accelerator.IsAltDown()); |
523 case CYCLE_BACKWARD_LINEAR: | 527 case CYCLE_BACKWARD_LINEAR: |
| 528 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 529 switches::kAshEnableOverviewMode)) { |
| 530 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5); |
| 531 ToggleOverviewMode(); |
| 532 return true; |
| 533 } |
524 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) | 534 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) |
525 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5); | 535 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5); |
526 HandleCycleWindowLinear(CYCLE_BACKWARD); | 536 HandleCycleWindowLinear(CYCLE_BACKWARD); |
527 return true; | 537 return true; |
528 case CYCLE_FORWARD_LINEAR: | 538 case CYCLE_FORWARD_LINEAR: |
| 539 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 540 switches::kAshEnableOverviewMode)) { |
| 541 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5); |
| 542 ToggleOverviewMode(); |
| 543 return true; |
| 544 } |
529 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) | 545 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) |
530 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_F5); | 546 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_F5); |
531 HandleCycleWindowLinear(CYCLE_FORWARD); | 547 HandleCycleWindowLinear(CYCLE_FORWARD); |
532 return true; | 548 return true; |
533 #if defined(OS_CHROMEOS) | 549 #if defined(OS_CHROMEOS) |
534 case ADD_REMOVE_DISPLAY: | 550 case ADD_REMOVE_DISPLAY: |
535 Shell::GetInstance()->display_manager()->AddRemoveDisplay(); | 551 Shell::GetInstance()->display_manager()->AddRemoveDisplay(); |
536 return true; | 552 return true; |
537 case TOGGLE_MIRROR_MODE: | 553 case TOGGLE_MIRROR_MODE: |
538 Shell::GetInstance()->display_controller()->ToggleMirrorMode(); | 554 Shell::GetInstance()->display_controller()->ToggleMirrorMode(); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 keyboard_brightness_control_delegate) { | 984 keyboard_brightness_control_delegate) { |
969 keyboard_brightness_control_delegate_ = | 985 keyboard_brightness_control_delegate_ = |
970 keyboard_brightness_control_delegate.Pass(); | 986 keyboard_brightness_control_delegate.Pass(); |
971 } | 987 } |
972 | 988 |
973 bool AcceleratorController::CanHandleAccelerators() const { | 989 bool AcceleratorController::CanHandleAccelerators() const { |
974 return true; | 990 return true; |
975 } | 991 } |
976 | 992 |
977 } // namespace ash | 993 } // namespace ash |
OLD | NEW |