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.
4
5#ifndef CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
6#define CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
7#pragma once
8
9#include "base/hash_tables.h"
10#include "ui/base/models/accelerator_gtk.h"
11
12template <typename T> struct DefaultSingletonTraits;
13
14class AcceleratorsGtk {
15 public:
16  typedef std::vector<std::pair<int, ui::AcceleratorGtk> >
17      AcceleratorGtkList;
18  typedef AcceleratorGtkList::const_iterator const_iterator;
19
20  // Returns the singleton instance.
21  static AcceleratorsGtk* GetInstance();
22
23  const_iterator const begin() {
24    return all_accelerators_.begin();
25  }
26
27  const_iterator const end() {
28    return all_accelerators_.end();
29  }
30
31  // Returns NULL if there is no accelerator for the command.
32  const ui::AcceleratorGtk* GetPrimaryAcceleratorForCommand(int command_id);
33
34 private:
35  friend struct DefaultSingletonTraits<AcceleratorsGtk>;
36
37  AcceleratorsGtk();
38  ~AcceleratorsGtk();
39
40  base::hash_map<int, ui::AcceleratorGtk> primary_accelerators_;
41
42  AcceleratorGtkList all_accelerators_;
43};
44
45#endif  // CHROME_BROWSER_UI_GTK_ACCELERATORS_GTK_H_
46