1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
8 #include "base/containers/hash_tables.h"
9 #include "ui/base/accelerators/accelerator.h"
11 template <typename T> struct DefaultSingletonTraits;
13 class AcceleratorsGtk {
15 typedef std::vector<std::pair<int, ui::Accelerator> > AcceleratorList;
16 typedef AcceleratorList::const_iterator const_iterator;
18 // Returns the singleton instance.
19 static AcceleratorsGtk* GetInstance();
21 const_iterator const begin() { return all_accelerators_.begin(); }
22 const_iterator const end() { return all_accelerators_.end(); }
24 // Returns NULL if there is no accelerator for the command.
25 const ui::Accelerator* GetPrimaryAcceleratorForCommand(int command_id);
28 friend struct DefaultSingletonTraits<AcceleratorsGtk>;
33 typedef base::hash_map<int, ui::Accelerator> AcceleratorMap;
34 AcceleratorMap primary_accelerators_;
36 AcceleratorList all_accelerators_;
39 #endif // CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_