summaryrefslogtreecommitdiffstats
path: root/ui/views/focus
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 09:53:29 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 09:53:29 +0000
commit5188dca135b28af1bfe2ac2d562fe8c42a86e795 (patch)
tree2de29d809c8b8c24bf9b7a556d921f8a30bc4fd1 /ui/views/focus
parentc29c63a69ce698dc756ce155f90c1341a1303ba6 (diff)
downloadchromium_src-5188dca135b28af1bfe2ac2d562fe8c42a86e795.zip
chromium_src-5188dca135b28af1bfe2ac2d562fe8c42a86e795.tar.gz
chromium_src-5188dca135b28af1bfe2ac2d562fe8c42a86e795.tar.bz2
Config UI for Extension Commands (part 1).
This changes the current overlay so that input is possible (selecting which keyboard shortcut to use). It also suspends current Chrome keyboard handling (Views only), while capturing the shortcut, so that you can press ie. Ctrl-F without Chrome eating your keyboard assignment and instead showing the Find box. NOTE: This does not persist the user's choice (future changelist). BUG=121420 TEST=With a keybinding Extension installed, open chrome://extensions, click on Configure Commands, and notice that the shortcuts are listed in text boxes that are clickable and accept keyboard input. Review URL: https://chromiumcodereview.appspot.com/10514003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/focus')
-rw-r--r--ui/views/focus/focus_manager.cc5
-rw-r--r--ui/views/focus/focus_manager.h10
2 files changed, 15 insertions, 0 deletions
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index 3c2c8d7..db63206 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -21,6 +21,8 @@
namespace views {
+bool FocusManager::shortcut_handling_suspended_ = false;
+
FocusManager::FocusManager(Widget* widget, FocusManagerDelegate* delegate)
: widget_(widget),
delegate_(delegate),
@@ -76,6 +78,9 @@ bool FocusManager::OnKeyEvent(const KeyEvent& event) {
return false;
#endif
+ if (shortcut_handling_suspended())
+ return true;
+
int modifiers = ui::EF_NONE;
if (event.IsShiftDown())
modifiers |= ui::EF_SHIFT_DOWN;
diff --git a/ui/views/focus/focus_manager.h b/ui/views/focus/focus_manager.h
index a262180..e25c3ff 100644
--- a/ui/views/focus/focus_manager.h
+++ b/ui/views/focus/focus_manager.h
@@ -188,6 +188,13 @@ class VIEWS_EXPORT FocusManager {
// Returns true if in the process of changing the focused view.
bool is_changing_focus() const { return is_changing_focus_; }
+ // Disable shortcut handling.
+ static void set_shortcut_handling_suspended(bool suspended) {
+ shortcut_handling_suspended_ = suspended;
+ }
+ // Returns whether shortcut handling is currently suspended.
+ bool shortcut_handling_suspended() { return shortcut_handling_suspended_; }
+
// Register a keyboard accelerator for the specified target. If multiple
// targets are registered for an accelerator, a target registered later has
// higher priority.
@@ -268,6 +275,9 @@ class VIEWS_EXPORT FocusManager {
View* starting_view,
bool reverse);
+ // Keeps track of whether shortcut handling is currently suspended.
+ static bool shortcut_handling_suspended_;
+
// The top-level Widget this FocusManager is associated with.
Widget* widget_;