Separate common accelerator utils out.

This commit is contained in:
Cheng Zhao 2014-03-15 16:36:29 +08:00
parent 5e2c975758
commit e3a3c342de
6 changed files with 62 additions and 92 deletions

View file

@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#include "browser/native_window.h"
#include "browser/ui/accelerator_util.h"
#include "browser/ui/gtk/menu_gtk.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/base/accelerators/accelerator.h"
@ -67,19 +68,9 @@ class NativeWindowGtk : public NativeWindow,
const std::vector<DraggableRegion>& regions) OVERRIDE;
private:
typedef struct { int position; ui::MenuModel* model; } MenuItem;
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Register accelerators supported by the menu model.
void RegisterAccelerators();
// Generate a table that contains memu model's accelerators and command ids.
void GenerateAcceleratorTable();
// Helper to fill the accelerator table from the model.
void FillAcceleratorTable(AcceleratorTable* table,
ui::MenuModel* model);
// Set WebKit's style from current theme.
void SetWebKitColorStyle();
@ -130,7 +121,7 @@ class NativeWindowGtk : public NativeWindow,
scoped_ptr<MenuGtk> menu_;
// Map from accelerator to menu item's command id.
AcceleratorTable accelerator_table_;
accelerator_util::AcceleratorTable accelerator_table_;
DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk);
};