| 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/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 WindowCycleEventFilter::WindowCycleEventFilter() { | 41 WindowCycleEventFilter::WindowCycleEventFilter() { |
| 42 Shell::GetInstance()->AddPreTargetHandler(this); | 42 Shell::GetInstance()->AddPreTargetHandler(this); |
| 43 } | 43 } |
| 44 | 44 |
| 45 WindowCycleEventFilter::~WindowCycleEventFilter() { | 45 WindowCycleEventFilter::~WindowCycleEventFilter() { |
| 46 Shell::GetInstance()->RemovePreTargetHandler(this); | 46 Shell::GetInstance()->RemovePreTargetHandler(this); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { | 49 void WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { |
| 50 // Until the alt key is released, all key events are handled by this window |
| 51 // cycle controller: https://crbug.com/340339. |
| 52 event->StopPropagation(); |
| 50 // Views uses VKEY_MENU for both left and right Alt keys. | 53 // Views uses VKEY_MENU for both left and right Alt keys. |
| 51 if (event->key_code() == ui::VKEY_MENU && | 54 if (event->key_code() == ui::VKEY_MENU && |
| 52 event->type() == ui::ET_KEY_RELEASED) { | 55 event->type() == ui::ET_KEY_RELEASED) { |
| 53 Shell::GetInstance()->window_cycle_controller()->StopCycling(); | 56 Shell::GetInstance()->window_cycle_controller()->StopCycling(); |
| 54 // Warning: |this| will be deleted from here on. | 57 // Warning: |this| will be deleted from here on. |
| 55 } | 58 } |
| 56 } | 59 } |
| 57 | 60 |
| 58 } // namespace | 61 } // namespace |
| 59 | 62 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 122 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 120 Shell::GetInstance() | 123 Shell::GetInstance() |
| 121 ->metrics() | 124 ->metrics() |
| 122 ->task_switch_metrics_recorder() | 125 ->task_switch_metrics_recorder() |
| 123 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); | 126 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); |
| 124 } | 127 } |
| 125 active_window_before_window_cycle_ = nullptr; | 128 active_window_before_window_cycle_ = nullptr; |
| 126 } | 129 } |
| 127 | 130 |
| 128 } // namespace ash | 131 } // namespace ash |
| OLD | NEW |