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

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

Issue 14827004: cros: Arrow key traversal in views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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.h
diff --git a/ui/views/focus/focus_manager.h b/ui/views/focus/focus_manager.h
index 35bfa11a06974773870cc7cbdbea0cfbb53a199d..6a17fc2bc1a00e8174cc637f787efecdf6ba9d53 100644
--- a/ui/views/focus/focus_manager.h
+++ b/ui/views/focus/focus_manager.h
@@ -150,7 +150,7 @@ class VIEWS_EXPORT FocusManager {
FocusManager(Widget* widget, FocusManagerDelegate* delegate);
virtual ~FocusManager();
- // Processes the passed key event for accelerators and tab traversal.
+ // Processes the passed key event for accelerators and keyboard traversal.
// Returns false if the event has been consumed and should not be processed
// further.
bool OnKeyEvent(const ui::KeyEvent& event);
@@ -296,6 +296,17 @@ class VIEWS_EXPORT FocusManager {
// pressed).
static bool IsTabTraversalKeyEvent(const ui::KeyEvent& key_event);
+ // Sets whether arrow key traversal is enabled. When enabled, right/down key
+ // behaves like tab and left/up key behaves like shift-tab. Note when this
+ // is enabled, the arrow key movement within grouped views are disabled.
+ static void set_arrow_key_traversal_enabled(bool enabled) {
+ arrow_key_traversal_enabled_ = enabled;
+ }
+ // Returns whether arrow key traversal is enabled.
+ static bool arrow_key_traversal_enabled() {
+ return arrow_key_traversal_enabled_;
+ }
+
private:
// Returns the next focusable view.
View* GetNextFocusableView(View* starting_view, bool reverse, bool dont_loop);
@@ -308,9 +319,16 @@ class VIEWS_EXPORT FocusManager {
View* starting_view,
bool reverse);
+ // Process arrow key traversal. Returns true if the event has been consumed
+ // and should not be processed further.
+ bool ProcessArrowKeyTraversal(const ui::KeyEvent& event);
+
// Keeps track of whether shortcut handling is currently suspended.
static bool shortcut_handling_suspended_;
+ // Whether arrow key traversal is enabled.
+ static bool arrow_key_traversal_enabled_;
+
// The top-level Widget this FocusManager is associated with.
Widget* widget_;

Powered by Google App Engine
This is Rietveld 408576698