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

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: 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..147ca5e64ae03c60e68dbd16eec857c7d6052994 100644
--- a/ui/views/focus/focus_manager.h
+++ b/ui/views/focus/focus_manager.h
@@ -120,7 +120,7 @@ class VIEWS_EXPORT FocusChangeListener {
virtual ~FocusChangeListener() {}
};
-class VIEWS_EXPORT FocusManager {
+class VIEWS_EXPORT FocusManager : public ui::AcceleratorProcessor {
public:
// The reason why the focus changed.
enum FocusChangeReason {
@@ -147,8 +147,8 @@ class VIEWS_EXPORT FocusManager {
kNoWrap
};
- FocusManager(Widget* widget, FocusManagerDelegate* delegate);
- virtual ~FocusManager();
+ FocusManager(Widget* widget);
sky 2015/01/08 23:39:26 explicit
Andre 2015/01/09 00:06:15 Done.
+ ~FocusManager() override;
// Processes the passed key event for accelerators and keyboard traversal.
// Returns false if the event has been consumed and should not be processed
@@ -225,13 +225,6 @@ 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;
- }
- // 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.
@@ -260,14 +253,6 @@ class VIEWS_EXPORT FocusManager {
// Unregister all keyboard accelerator for the specified target.
void UnregisterAccelerators(ui::AcceleratorTarget* target);
- // Activate the target associated with the specified accelerator.
- // First, AcceleratorPressed handler of the most recently registered target
- // is called, and if that handler processes the event (i.e. returns true),
- // this method immediately returns. If not, we do the same thing on the next
- // target, and so on.
- // Returns true if an accelerator was activated.
- bool ProcessAccelerator(const ui::Accelerator& accelerator);
-
// Resets menu key state if |event| is not menu key release.
// This is effective only on x11.
void MaybeResetMenuKeyState(const ui::KeyEvent& key);
@@ -283,11 +268,13 @@ class VIEWS_EXPORT FocusManager {
void AddFocusChangeListener(FocusChangeListener* listener);
void RemoveFocusChangeListener(FocusChangeListener* listener);
- // Returns the AcceleratorTarget that should be activated for the specified
- // keyboard accelerator, or NULL if no view is registered for that keyboard
- // accelerator.
- ui::AcceleratorTarget* GetCurrentTargetForAccelerator(
- const ui::Accelerator& accelerator) const;
+ // Adds/removes an accelerator processor.
sky 2015/01/08 23:39:26 How about test coverage of some of this new functi
+ // PreProcessors are given a chance to process an accelerator before normal
+ // processing.
+ // PostProcessors are given a chance to process unhandled accelerators.
+ void AddAcceleratorPreProcessor(ui::AcceleratorProcessor*);
sky 2015/01/08 23:39:26 style guide says you should have names here.
Andre 2015/01/09 00:06:15 Done.
+ void AddAcceleratorPostProcessor(ui::AcceleratorProcessor*);
+ void RemoveAcceleratorProcessor(ui::AcceleratorProcessor*);
// Whether the given |accelerator| has a priority handler associated with it.
bool HasPriorityHandler(const ui::Accelerator& accelerator) const;
@@ -331,6 +318,11 @@ class VIEWS_EXPORT FocusManager {
bool reverse,
bool dont_loop);
+ // Overridden from ui::AcceleratorProcessor:
+ bool ProcessAccelerator(const ui::Accelerator& accelerator) override;
+ ui::AcceleratorTarget* GetTargetForAccelerator(
+ const ui::Accelerator& accelerator) const override;
+
private:
// Returns the focusable view found in the FocusTraversable specified starting
// at the specified view. This traverses down along the FocusTraversable
@@ -344,25 +336,20 @@ 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_;
// The top-level Widget this FocusManager is associated with.
Widget* widget_;
- // The object which handles an accelerator when |accelerator_manager_| doesn't
- // handle it.
- scoped_ptr<FocusManagerDelegate> delegate_;
-
// The view that currently is focused.
View* focused_view_;
// The AcceleratorManager this FocusManager is associated with.
scoped_ptr<ui::AcceleratorManager> accelerator_manager_;
+ std::list<ui::AcceleratorProcessor*> accelerator_processors_;
+
// 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