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..42f45929b60645c68ec7e48c23130d798f77804a 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,28 @@ bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) { |
return false; |
} |
+ui::Accelerator GetPrimaryChromeAcceleratorForCommandId(int command_id) { |
+ ui::Accelerator accelerator; |
+ // GetAshAcceleratorForCommandId with HOST_DESKTOP_TYPE_ASH is used so we can |
+ // find Ash accelerators if Ash is supported on this platform, even if it's |
+ // not currently in use. |
+ if (GetStandardAcceleratorForCommandId(command_id, &accelerator) || |
+ GetAshAcceleratorForCommandId(command_id, |
+ HOST_DESKTOP_TYPE_ASH, |
+ &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 |