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

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 727583002: Regression: Search+Key pops up app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
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 "ui/views/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "ui/base/accelerators/accelerator.h" 13 #include "ui/base/accelerators/accelerator.h"
14 #include "ui/base/accelerators/accelerator_history.h"
14 #include "ui/base/ime/input_method.h" 15 #include "ui/base/ime/input_method.h"
15 #include "ui/base/ime/text_input_client.h" 16 #include "ui/base/ime/text_input_client.h"
16 #include "ui/base/ime/text_input_focus_manager.h" 17 #include "ui/base/ime/text_input_focus_manager.h"
17 #include "ui/base/ui_base_switches_util.h" 18 #include "ui/base/ui_base_switches_util.h"
18 #include "ui/events/event.h" 19 #include "ui/events/event.h"
19 #include "ui/events/keycodes/keyboard_codes.h" 20 #include "ui/events/keycodes/keyboard_codes.h"
20 #include "ui/views/focus/focus_manager_delegate.h" 21 #include "ui/views/focus/focus_manager_delegate.h"
21 #include "ui/views/focus/focus_search.h" 22 #include "ui/views/focus/focus_search.h"
22 #include "ui/views/focus/view_storage.h" 23 #include "ui/views/focus/view_storage.h"
23 #include "ui/views/focus/widget_focus_manager.h" 24 #include "ui/views/focus/widget_focus_manager.h"
(...skipping 28 matching lines...) Expand all
52 53
53 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) { 54 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) {
54 const int key_code = event.key_code(); 55 const int key_code = event.key_code();
55 56
56 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED) 57 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED)
57 return false; 58 return false;
58 59
59 if (shortcut_handling_suspended()) 60 if (shortcut_handling_suspended())
60 return true; 61 return true;
61 62
62 int modifiers = ui::EF_NONE; 63 ui::Accelerator accelerator(ui::AcceleratorHistory::GetInstance()->
63 if (event.IsShiftDown()) 64 GetCurrentAccelerator());
Jun Mukai 2014/11/17 17:39:20 Can we revert this? Is there any specific reason
afakhry 2014/11/17 23:10:18 Done.
64 modifiers |= ui::EF_SHIFT_DOWN;
65 if (event.IsControlDown())
66 modifiers |= ui::EF_CONTROL_DOWN;
67 if (event.IsAltDown())
68 modifiers |= ui::EF_ALT_DOWN;
69 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
70 if (event.IsCommandDown())
71 modifiers |= ui::EF_COMMAND_DOWN;
72 #endif
73 ui::Accelerator accelerator(event.key_code(), modifiers);
74 accelerator.set_type(event.type());
75 accelerator.set_is_repeat(event.IsRepeat());
76 65
77 if (event.type() == ui::ET_KEY_PRESSED) { 66 if (event.type() == ui::ET_KEY_PRESSED) {
78 // If the focused view wants to process the key event as is, let it be. 67 // If the focused view wants to process the key event as is, let it be.
79 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && 68 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) &&
80 !accelerator_manager_->HasPriorityHandler(accelerator)) 69 !accelerator_manager_->HasPriorityHandler(accelerator))
81 return true; 70 return true;
82 71
83 // Intercept Tab related messages for focus traversal. 72 // Intercept Tab related messages for focus traversal.
84 // Note that we don't do focus traversal if the root window is not part of 73 // Note that we don't do focus traversal if the root window is not part of
85 // the active window hierarchy as this would mean we have no focused view 74 // the active window hierarchy as this would mean we have no focused view
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 593 }
605 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { 594 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) {
606 AdvanceFocus(false); 595 AdvanceFocus(false);
607 return true; 596 return true;
608 } 597 }
609 598
610 return false; 599 return false;
611 } 600 }
612 601
613 } // namespace views 602 } // namespace views
OLDNEW
« ui/base/accelerators/accelerator_history.h ('K') | « ui/base/ui_base.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698