| Index: ui/views/focus/focus_manager.cc
|
| diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
|
| index 706b3182721dcafe37b86665445094ac5a4d283a..895f767dc5757c1892f7928cf1ff9bb9c02703f5 100644
|
| --- a/ui/views/focus/focus_manager.cc
|
| +++ b/ui/views/focus/focus_manager.cc
|
| @@ -17,7 +17,6 @@
|
| #include "ui/base/ui_base_switches_util.h"
|
| #include "ui/events/event.h"
|
| #include "ui/events/keycodes/keyboard_codes.h"
|
| -#include "ui/views/focus/focus_manager_delegate.h"
|
| #include "ui/views/focus/focus_search.h"
|
| #include "ui/views/focus/view_storage.h"
|
| #include "ui/views/focus/widget_focus_manager.h"
|
| @@ -44,12 +43,10 @@ static inline int CalculateModifiers(const ui::KeyEvent& event) {
|
|
|
| } // namespace
|
|
|
| -bool FocusManager::shortcut_handling_suspended_ = false;
|
| bool FocusManager::arrow_key_traversal_enabled_ = false;
|
|
|
| -FocusManager::FocusManager(Widget* widget, FocusManagerDelegate* delegate)
|
| +FocusManager::FocusManager(Widget* widget)
|
| : widget_(widget),
|
| - delegate_(delegate),
|
| focused_view_(NULL),
|
| accelerator_manager_(new ui::AcceleratorManager),
|
| focus_change_reason_(kReasonDirectFocusChange),
|
| @@ -57,6 +54,7 @@ FocusManager::FocusManager(Widget* widget, FocusManagerDelegate* delegate)
|
| DCHECK(widget_);
|
| stored_focused_view_storage_id_ =
|
| ViewStorage::GetInstance()->CreateStorageID();
|
| + accelerator_processors_.push_back(accelerator_manager_.get());
|
| }
|
|
|
| FocusManager::~FocusManager() {
|
| @@ -68,9 +66,6 @@ bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) {
|
| if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED)
|
| return false;
|
|
|
| - if (shortcut_handling_suspended())
|
| - return true;
|
| -
|
| int modifiers = CalculateModifiers(event);
|
| ui::Accelerator accelerator(event.key_code(), modifiers);
|
| accelerator.set_type(event.type());
|
| @@ -552,20 +547,37 @@ void FocusManager::UnregisterAccelerators(ui::AcceleratorTarget* target) {
|
| }
|
|
|
| bool FocusManager::ProcessAccelerator(const ui::Accelerator& accelerator) {
|
| - if (accelerator_manager_->Process(accelerator))
|
| - return true;
|
| - if (delegate_.get())
|
| - return delegate_->ProcessAccelerator(accelerator);
|
| + for (ui::AcceleratorProcessor* processor : accelerator_processors_) {
|
| + if (processor->ProcessAccelerator(accelerator))
|
| + return true;
|
| + }
|
| return false;
|
| }
|
|
|
| -ui::AcceleratorTarget* FocusManager::GetCurrentTargetForAccelerator(
|
| +ui::AcceleratorTarget* FocusManager::GetTargetForAccelerator(
|
| const ui::Accelerator& accelerator) const {
|
| - ui::AcceleratorTarget* target =
|
| - accelerator_manager_->GetCurrentTarget(accelerator);
|
| - if (!target && delegate_.get())
|
| - target = delegate_->GetCurrentTargetForAccelerator(accelerator);
|
| - return target;
|
| + for (ui::AcceleratorProcessor* processor : accelerator_processors_) {
|
| + ui::AcceleratorTarget* target =
|
| + processor->GetTargetForAccelerator(accelerator);
|
| + if (target)
|
| + return target;
|
| + }
|
| + return nullptr;
|
| +}
|
| +
|
| +void FocusManager::AddAcceleratorPreProcessor(
|
| + ui::AcceleratorProcessor* processor) {
|
| + accelerator_processors_.push_front(processor);
|
| +}
|
| +
|
| +void FocusManager::AddAcceleratorPostProcessor(
|
| + ui::AcceleratorProcessor* processor) {
|
| + accelerator_processors_.push_back(processor);
|
| +}
|
| +
|
| +void FocusManager::RemoveAcceleratorProcessor(
|
| + ui::AcceleratorProcessor* processor) {
|
| + accelerator_processors_.remove(processor);
|
| }
|
|
|
| bool FocusManager::HasPriorityHandler(
|
|
|