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

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

Issue 399783002: Begin whitelisting specific extensions for global key registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update cl with new permission "commands.accessibility". Created 6 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 | Annotate | Revision Log
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"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (shortcut_handling_suspended()) 59 if (shortcut_handling_suspended())
60 return true; 60 return true;
61 61
62 int modifiers = ui::EF_NONE; 62 int modifiers = ui::EF_NONE;
63 if (event.IsShiftDown()) 63 if (event.IsShiftDown())
64 modifiers |= ui::EF_SHIFT_DOWN; 64 modifiers |= ui::EF_SHIFT_DOWN;
65 if (event.IsControlDown()) 65 if (event.IsControlDown())
66 modifiers |= ui::EF_CONTROL_DOWN; 66 modifiers |= ui::EF_CONTROL_DOWN;
67 if (event.IsAltDown()) 67 if (event.IsAltDown())
68 modifiers |= ui::EF_ALT_DOWN; 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
69 ui::Accelerator accelerator(event.key_code(), modifiers); 73 ui::Accelerator accelerator(event.key_code(), modifiers);
70 accelerator.set_type(event.type()); 74 accelerator.set_type(event.type());
71 accelerator.set_is_repeat(event.IsRepeat()); 75 accelerator.set_is_repeat(event.IsRepeat());
72 76
73 if (event.type() == ui::ET_KEY_PRESSED) { 77 if (event.type() == ui::ET_KEY_PRESSED) {
74 // If the focused view wants to process the key event as is, let it be. 78 // If the focused view wants to process the key event as is, let it be.
75 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && 79 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) &&
76 !accelerator_manager_->HasPriorityHandler(accelerator)) 80 !accelerator_manager_->HasPriorityHandler(accelerator))
77 return true; 81 return true;
78 82
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 589 }
586 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { 590 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) {
587 AdvanceFocus(false); 591 AdvanceFocus(false);
588 return true; 592 return true;
589 } 593 }
590 594
591 return false; 595 return false;
592 } 596 }
593 597
594 } // namespace views 598 } // namespace views
OLDNEW
« chrome/common/extensions/command_unittest.cc ('K') | « ui/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698