Chromium Code Reviews| Index: ash/accelerators/accelerator_controller_delegate.h |
| diff --git a/ash/accelerators/accelerator_controller_delegate.h b/ash/accelerators/accelerator_controller_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..81c06e45807a041cae4cf51335abb356d906f537 |
| --- /dev/null |
| +++ b/ash/accelerators/accelerator_controller_delegate.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ |
| +#define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ |
| + |
| +#include "ash/accelerators/accelerator_table.h" |
| +#include "ash/ash_export.h" |
| + |
| +namespace ui { |
| +class Accelerator; |
| +} |
| + |
| +namespace ash { |
| + |
| +// Used by AcceleratorController to handle environment specific commands. This |
| +// file is temporary while ash supports both mus and aura. |
| +class ASH_EXPORT AcceleratorControllerDelegate { |
| + public: |
| + // Returns true if the delegate is responsible for handling |action|. This |
| + // should not return whether the action may be enabled, only if this delegate |
| + // handles the action. |
| + virtual bool HandlesAction(AcceleratorAction action) = 0; |
| + |
| + // Returns true if the delegate can perform the action at this time. Only |
| + // invoked if HandlesAction() returns true. |
| + virtual bool CanPerformAction( |
| + AcceleratorAction action, |
| + const ui::Accelerator& accelerator, |
| + const ui::Accelerator& previous_accelerator) = 0; |
| + |
| + // Performs the specified action. |
| + virtual void PerformAction(AcceleratorAction action, |
| + const ui::Accelerator& accelerator) = 0; |
| + |
| + // Shows a warning the user is using a deprecated accelerator. |
| + virtual void ShowDeprecatedAcceleratorNotification( |
| + const char* const notification_id, |
| + int message_id, |
| + int old_shortcut_id, |
| + int new_shortcut_id) = 0; |
| + |
| + protected: |
| + virtual ~AcceleratorControllerDelegate() {} |
| +}; |
|
James Cook
2016/07/20 16:08:04
Nice documentation in this class.
|
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ |