Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ | |
| 6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ | |
| 7 | |
| 8 #include "ash/accelerators/accelerator_table.h" | |
| 9 #include "ash/ash_export.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 class Accelerator; | |
| 13 } | |
| 14 | |
| 15 namespace ash { | |
| 16 | |
| 17 // Used by AcceleratorController to handle environment specific commands. This | |
| 18 // file is temporary while ash supports both mus and aura. | |
| 19 class ASH_EXPORT AcceleratorControllerDelegate { | |
| 20 public: | |
| 21 // Returns true if the delegate is responsible for handling |action|. This | |
| 22 // should not return whether the action may be enabled, only if this delegate | |
| 23 // handles the action. | |
| 24 virtual bool HandlesAction(AcceleratorAction action) = 0; | |
| 25 | |
| 26 // Returns true if the delegate can perform the action at this time. Only | |
| 27 // invoked if HandlesAction() returns true. | |
| 28 virtual bool CanPerformAction( | |
| 29 AcceleratorAction action, | |
| 30 const ui::Accelerator& accelerator, | |
| 31 const ui::Accelerator& previous_accelerator) = 0; | |
| 32 | |
| 33 // Performs the specified action. | |
| 34 virtual void PerformAction(AcceleratorAction action, | |
| 35 const ui::Accelerator& accelerator) = 0; | |
| 36 | |
| 37 // Shows a warning the user is using a deprecated accelerator. | |
| 38 virtual void ShowDeprecatedAcceleratorNotification( | |
| 39 const char* const notification_id, | |
| 40 int message_id, | |
| 41 int old_shortcut_id, | |
| 42 int new_shortcut_id) = 0; | |
| 43 | |
| 44 protected: | |
| 45 virtual ~AcceleratorControllerDelegate() {} | |
| 46 }; | |
|
James Cook
2016/07/20 16:08:04
Nice documentation in this class.
| |
| 47 | |
| 48 } // namespace ash | |
| 49 | |
| 50 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_DELEGATE_H_ | |
| OLD | NEW |