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

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: add docs and tests 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
« no previous file with comments | « chrome/browser/ui/omnibox/location_bar.cc ('k') | chrome/common/extensions/api/manifest_types.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/omnibox/location_bar.cc ('k') | chrome/common/extensions/api/manifest_types.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698