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

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

Issue 1083093006: Prevent delivery of tab release key events while alt tabbing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle all key events during alt tab window cycling. Created 4 years, 6 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/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
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
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
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