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

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

Issue 838253004: MacViews: Fix duplicate definition of ExtensionKeyBindingRegistry::SetShortcutHandlingSuspended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DragBookmarks2
Patch Set: Use callback Created 5 years, 11 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 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_;

Powered by Google App Engine
This is Rietveld 408576698