Chromium Code Reviews| Index: ash/accelerators/ash_menu_event_filter_delegate.cc |
| diff --git a/ash/accelerators/ash_menu_event_filter_delegate.cc b/ash/accelerators/ash_menu_event_filter_delegate.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..03bb1934166e23a4c70f2f553259a1ea3b289a15 |
| --- /dev/null |
| +++ b/ash/accelerators/ash_menu_event_filter_delegate.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/accelerators/ash_menu_event_filter_delegate.h" |
| + |
| +#include "ash/accelerators/accelerator_controller.h" |
| +#include "ash/shell.h" |
| +#include "ui/views/controls/menu/menu_event_filter.h" |
| + |
| +namespace ash { |
| + |
| +AshMenuEventFilterDelegate::AshMenuEventFilterDelegate( |
| + ui::AcceleratorHistory* history) |
|
pkotwicz
2015/08/28 23:44:25
Idle wondering: Any reason that you pass ui::Accel
afakhry
2015/08/29 01:31:23
No need to pass either actually. This part is such
|
| + : accelerator_history_(history) { |
| + DCHECK(history); |
| +} |
| + |
| +AshMenuEventFilterDelegate::~AshMenuEventFilterDelegate() {} |
| + |
| +void AshMenuEventFilterDelegate::StoreInHistory( |
| + const ui::Accelerator& accelerator) { |
| + accelerator_history_->StoreCurrentAccelerator(accelerator); |
| +} |
| + |
| +bool AshMenuEventFilterDelegate::ShouldCloseMenuAndRepostAccelerator( |
| + const ui::Accelerator& accelerator) const { |
| + return ash::Shell::GetInstance() |
| + ->accelerator_controller() |
| + ->ShouldCloseMenuAndRepostAccelerator(accelerator); |
| +} |
| + |
| +void AshMenuEventFilterDelegate::ProcessAcceleratorNow( |
| + const ui::Accelerator& accelerator) { |
| + ash::AcceleratorController* accelerator_controller = |
| + ash::Shell::GetInstance()->accelerator_controller(); |
| + accelerator_controller->Process(accelerator); |
| +} |
| + |
| +} // namespace ash |