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

Unified Diff: chrome/browser/ui/views/accelerator_utils_views.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: 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_views.cc
diff --git a/chrome/browser/ui/views/accelerator_utils_views.cc b/chrome/browser/ui/views/accelerator_utils_views.cc
index c2c77db65bd2fc03d7cbbce70e1445a91961f937..c8f1f18eccdcb9e7db0d549a02cd61a73390e337 100644
--- a/chrome/browser/ui/views/accelerator_utils_views.cc
+++ b/chrome/browser/ui/views/accelerator_utils_views.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/views/accelerator_table.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
namespace chrome {
@@ -24,4 +25,18 @@ bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) {
#endif // !USE_AURA
+ui::Accelerator GetChromeAcceleratorForCommandId(int command_id) {
sky 2014/02/04 22:52:54 Accelerators handled in ash aren't covered here. A
Mike Wittman 2014/02/05 18:10:46 I've added a check for Ash accelerators (and stand
sky 2014/02/06 16:03:16 Ah, ok. Good point.
+ 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