| 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..123f9153d72083224442bf7f74dbdda02154657e 100644
|
| --- a/ui/views/focus/focus_manager.h
|
| +++ b/ui/views/focus/focus_manager.h
|
| @@ -13,6 +13,7 @@
|
| #include "base/observer_list.h"
|
| #include "ui/base/accelerators/accelerator.h"
|
| #include "ui/base/accelerators/accelerator_manager.h"
|
| +#include "ui/base/accelerators/accelerator_processor.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| #include "ui/views/views_export.h"
|
|
|
| @@ -120,7 +121,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 +148,8 @@ class VIEWS_EXPORT FocusManager {
|
| kNoWrap
|
| };
|
|
|
| - FocusManager(Widget* widget, FocusManagerDelegate* delegate);
|
| - virtual ~FocusManager();
|
| + explicit FocusManager(Widget* widget);
|
| + ~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 +226,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 +254,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 +269,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.
|
| + // 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* processor);
|
| + void AddAcceleratorPostProcessor(ui::AcceleratorProcessor* processor);
|
| + void RemoveAcceleratorProcessor(ui::AcceleratorProcessor* processor);
|
|
|
| // Whether the given |accelerator| has a priority handler associated with it.
|
| bool HasPriorityHandler(const ui::Accelerator& accelerator) const;
|
| @@ -331,6 +319,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 +337,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_;
|
|
|