1 // Copyright 2014 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.
5 #ifndef UI_BASE_ACCELERATORS_ACCELERATOR_HISTORY_H_
6 #define UI_BASE_ACCELERATORS_ACCELERATOR_HISTORY_H_
8 #include "base/memory/singleton.h"
9 #include "ui/base/accelerators/accelerator.h"
10 #include "ui/base/ui_base_export.h"
11 #include "ui/events/event.h"
12 #include "ui/events/event_handler.h"
16 // Keeps track of the system-wide current and the most recent previous
18 class UI_BASE_EXPORT AcceleratorHistory
{
21 ~AcceleratorHistory();
23 // Returns the most recent recorded accelerator.
24 const Accelerator
& current_accelerator() const {
25 return current_accelerator_
;
28 // Returns the most recent previously recorded accelerator that is different
30 const Accelerator
& previous_accelerator() const {
31 return previous_accelerator_
;
34 // Stores the given |accelerator| only if it's different than the currently
36 void StoreCurrentAccelerator(const Accelerator
& accelerator
);
39 Accelerator current_accelerator_
;
40 Accelerator previous_accelerator_
;
42 DISALLOW_COPY_AND_ASSIGN(AcceleratorHistory
);
47 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_HISTORY_H_