Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: ash/wm/window_cycle_controller.cc

Issue 2260973003: Don't handle the tab press event in the window cycle event filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698