| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/wm/mru_window_tracker.h" | 8 #include "ash/common/wm/mru_window_tracker.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 WindowCycleEventFilter::WindowCycleEventFilter() { | 40 WindowCycleEventFilter::WindowCycleEventFilter() { |
| 41 Shell::GetInstance()->AddPreTargetHandler(this); | 41 Shell::GetInstance()->AddPreTargetHandler(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 WindowCycleEventFilter::~WindowCycleEventFilter() { | 44 WindowCycleEventFilter::~WindowCycleEventFilter() { |
| 45 Shell::GetInstance()->RemovePreTargetHandler(this); | 45 Shell::GetInstance()->RemovePreTargetHandler(this); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { | 48 void WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { |
| 49 // Until the alt key is released, all key events are handled by this window | 49 // Until the alt key is released, all key events except the tab press (which |
| 50 // cycle controller: https://crbug.com/340339. | 50 // is handled by the accelerator controller to call Step) are handled by this |
| 51 event->StopPropagation(); | 51 // window cycle controller: https://crbug.com/340339. |
| 52 if (event->key_code() != ui::VKEY_TAB || |
| 53 event->type() != ui::ET_KEY_PRESSED) { |
| 54 event->StopPropagation(); |
| 55 } |
| 52 // Views uses VKEY_MENU for both left and right Alt keys. | 56 // Views uses VKEY_MENU for both left and right Alt keys. |
| 53 if (event->key_code() == ui::VKEY_MENU && | 57 if (event->key_code() == ui::VKEY_MENU && |
| 54 event->type() == ui::ET_KEY_RELEASED) { | 58 event->type() == ui::ET_KEY_RELEASED) { |
| 55 Shell::GetInstance()->window_cycle_controller()->StopCycling(); | 59 Shell::GetInstance()->window_cycle_controller()->StopCycling(); |
| 56 // Warning: |this| will be deleted from here on. | 60 // Warning: |this| will be deleted from here on. |
| 57 } | 61 } |
| 58 } | 62 } |
| 59 | 63 |
| 60 } // namespace | 64 } // namespace |
| 61 | 65 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 127 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 124 Shell::GetInstance() | 128 Shell::GetInstance() |
| 125 ->metrics() | 129 ->metrics() |
| 126 ->task_switch_metrics_recorder() | 130 ->task_switch_metrics_recorder() |
| 127 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); | 131 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); |
| 128 } | 132 } |
| 129 active_window_before_window_cycle_ = nullptr; | 133 active_window_before_window_cycle_ = nullptr; |
| 130 } | 134 } |
| 131 | 135 |
| 132 } // namespace ash | 136 } // namespace ash |
| OLD | NEW |