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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/focus/focus_manager.cc
===================================================================
--- ui/views/focus/focus_manager.cc (revision 122745)
+++ ui/views/focus/focus_manager.cc (working copy)
@@ -74,11 +74,17 @@
return false;
#endif
+ ui::Accelerator accelerator(event.key_code(),
+ event.IsShiftDown(),
+ event.IsControlDown(),
+ event.IsAltDown());
+
#if defined(OS_WIN)
// If the focused view wants to process the key event as is, let it be.
// On Linux we always dispatch key events to the focused view first, so
// we should not do this check here. See also NativeWidgetGtk::OnKeyEvent().
- if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event))
+ if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) &&
+ !accelerator_manager_->HasPriorityHandler(accelerator))
return true;
#endif
@@ -125,10 +131,6 @@
// Process keyboard accelerators.
// If the key combination matches an accelerator, the accelerator is
// triggered, otherwise the key event is processed as usual.
- ui::Accelerator accelerator(event.key_code(),
- event.IsShiftDown(),
- event.IsControlDown(),
- event.IsAltDown());
if (ProcessAccelerator(accelerator)) {
// If a shortcut was activated for this keydown message, do not propagate
// the event further.
@@ -302,7 +304,7 @@
return;
}
- // TODO (jcampan): when a TabContents containing a popup is closed, the focus
+ // TODO(jcivelli): when a TabContents containing a popup is closed, the focus
// is stored twice causing an assert. We should find a better alternative than
// removing the view from the storage explicitly.
view_storage->RemoveView(stored_focused_view_storage_id_);
@@ -405,8 +407,9 @@
void FocusManager::RegisterAccelerator(
const ui::Accelerator& accelerator,
+ bool priority,
ui::AcceleratorTarget* target) {
- accelerator_manager_->Register(accelerator, target);
+ accelerator_manager_->Register(accelerator, priority, target);
}
void FocusManager::UnregisterAccelerator(const ui::Accelerator& accelerator,
@@ -444,6 +447,11 @@
return accelerator_manager_->GetCurrentTarget(accelerator);
}
+bool FocusManager::HasPriorityHandler(
+ const ui::Accelerator& accelerator) const {
+ return accelerator_manager_->HasPriorityHandler(accelerator);
+}
+
// static
bool FocusManager::IsTabTraversalKeyEvent(const KeyEvent& key_event) {
return key_event.key_code() == ui::VKEY_TAB && !key_event.IsControlDown();

Powered by Google App Engine
This is Rietveld 408576698