Index: ui/views/focus/focus_manager.h |
diff --git a/ui/views/focus/focus_manager.h b/ui/views/focus/focus_manager.h |
index 3ba730d55e337f07b78a6708da9cfddfb6c99a3b..495c9c55767d3aa1ca3dde33a159ea51e0c92a00 100644 |
--- a/ui/views/focus/focus_manager.h |
+++ b/ui/views/focus/focus_manager.h |
@@ -9,6 +9,7 @@ |
#include <map> |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
#include "ui/base/accelerators/accelerator.h" |
@@ -225,12 +226,13 @@ class VIEWS_EXPORT FocusManager { |
void FocusTextInputClient(View* view); |
void BlurTextInputClient(View* view); |
- // Disable shortcut handling. |
- static void set_shortcut_handling_suspended(bool suspended) { |
- shortcut_handling_suspended_ = suspended; |
- } |
+ // Installs a callback to control whether to disable shortcut handling. |
+ // Accelerator processing is skipped if |callback| returns true. |
+ typedef base::Callback<bool()> ReturnBoolCallback; |
+ void set_shortcut_handling_suspended_callback(ReturnBoolCallback* callback); |
+ |
// Returns whether shortcut handling is currently suspended. |
- bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } |
+ bool shortcut_handling_suspended() const; |
// Register a keyboard accelerator for the specified target. If multiple |
// targets are registered for an accelerator, a target registered later has |
@@ -344,9 +346,6 @@ class VIEWS_EXPORT FocusManager { |
// 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_; |
@@ -363,6 +362,9 @@ class VIEWS_EXPORT FocusManager { |
// The AcceleratorManager this FocusManager is associated with. |
scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
+ // Accelerator processing is skipped if this callback returns true. |
+ ReturnBoolCallback* shortcut_handling_suspended_callback_; |
+ |
// The storage id used in the ViewStorage to store/restore the view that last |
// had focus. |
int stored_focused_view_storage_id_; |