2016-07-06 23:04:18 +00:00
|
|
|
// Copyright (c) 2016 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "atom/browser/ui/views/menu_model_adapter.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
MenuModelAdapter::MenuModelAdapter(AtomMenuModel* menu_model)
|
2018-04-18 01:55:30 +00:00
|
|
|
: views::MenuModelAdapter(menu_model), menu_model_(menu_model) {}
|
2016-07-06 23:04:18 +00:00
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
MenuModelAdapter::~MenuModelAdapter() {}
|
2016-07-06 23:04:18 +00:00
|
|
|
|
|
|
|
bool MenuModelAdapter::GetAccelerator(int id,
|
|
|
|
ui::Accelerator* accelerator) const {
|
|
|
|
ui::MenuModel* model = menu_model_;
|
|
|
|
int index = 0;
|
|
|
|
if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) {
|
2018-04-18 01:55:30 +00:00
|
|
|
return static_cast<AtomMenuModel*>(model)->GetAcceleratorAtWithParams(
|
|
|
|
index, true, accelerator);
|
2016-07-06 23:04:18 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|