Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: chrome/browser/ui/views/accelerator_utils_aura.cc

Issue 143493005: Allow extensions to remove and override the bookmark shortcut key (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove use of GetActiveDesktop() Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698