Chromium Code Reviews| Index: chrome/browser/ui/views/accelerator_utils_aura.cc |
| diff --git a/chrome/browser/ui/views/accelerator_utils_aura.cc b/chrome/browser/ui/views/accelerator_utils_aura.cc |
| index 199f8c4af8f6370af4e6dacd0e6b476e4d475c0d..47da06f1b23a14c1a0571121a60f0d94d12b7e8e 100644 |
| --- a/chrome/browser/ui/views/accelerator_utils_aura.cc |
| +++ b/chrome/browser/ui/views/accelerator_utils_aura.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/host_desktop.h" |
| #include "chrome/browser/ui/views/accelerator_table.h" |
| #include "ui/base/accelerators/accelerator.h" |
| @@ -35,4 +36,26 @@ bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) { |
| return false; |
| } |
| +ui::Accelerator GetPrimaryChromeAcceleratorForCommandId(int command_id) { |
| + ui::Accelerator accelerator; |
| + if (GetStandardAcceleratorForCommandId(command_id, &accelerator)) |
|
sky
2014/02/06 16:03:16
nit: I would likely combine this if and 43.
|
| + return accelerator; |
| + if (GetAshAcceleratorForCommandId(command_id, |
| + chrome::GetActiveDesktop(), |
|
sky
2014/02/06 16:03:16
Using activedesktop like this is a bit dicey. Is t
Mike Wittman
2014/02/06 19:35:42
This is invoked from the extension command service
|
| + &accelerator)) { |
| + return accelerator; |
| + } |
| + |
| + std::vector<chrome::AcceleratorMapping> accelerators = |
| + chrome::GetAcceleratorList(); |
| + for (size_t i = 0; i < accelerators.size(); ++i) { |
| + if (accelerators[i].command_id == command_id) { |
| + return ui::Accelerator(accelerators[i].keycode, |
| + accelerators[i].modifiers); |
| + } |
| + } |
| + |
| + return ui::Accelerator(); |
| +} |
| + |
| } // namespace chrome |