| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_ |
| 6 #define UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_ |
| 7 |
| 8 #include "ui/base/ui_base_export.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 class Accelerator; |
| 13 class AcceleratorTarget; |
| 14 |
| 15 // An interface for dispatching accelerators to AcceleratorTargets. |
| 16 class UI_BASE_EXPORT AcceleratorProcessor { |
| 17 public: |
| 18 // Activate the target associated with the specified accelerator. |
| 19 // First, AcceleratorPressed handler of the most recently registered target |
| 20 // is called, and if that handler processes the event (i.e. returns true), |
| 21 // this method immediately returns. If not, we do the same thing on the next |
| 22 // target, and so on. |
| 23 // Returns true if an accelerator was activated. |
| 24 virtual bool ProcessAccelerator(const Accelerator& accelerator) = 0; |
| 25 |
| 26 // Returns the AcceleratorTarget that should be activated for the specified |
| 27 // keyboard accelerator, or NULL if no target is registered for that keyboard |
| 28 // accelerator. |
| 29 virtual AcceleratorTarget* GetTargetForAccelerator( |
| 30 const Accelerator& accelerator) const = 0; |
| 31 |
| 32 protected: |
| 33 virtual ~AcceleratorProcessor() {} |
| 34 }; |
| 35 |
| 36 } // namespace ui |
| 37 |
| 38 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_ |
| OLD | NEW |