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

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

Issue 13044014: Make sure manifest specified shortcut for Extension Command can not override the built-in shortcuts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for ChromeOS (ash) Created 7 years, 8 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
new file mode 100644
index 0000000000000000000000000000000000000000..199f8c4af8f6370af4e6dacd0e6b476e4d475c0d
--- /dev/null
+++ b/chrome/browser/ui/views/accelerator_utils_aura.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/views/accelerator_table.h"
+#include "ui/base/accelerators/accelerator.h"
+
+#if defined(USE_ASH)
+#include "ash/accelerators/accelerator_table.h"
+#endif // USE_ASH
+
+namespace chrome {
+
+bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) {
+#if defined(USE_ASH)
+ for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) {
+ const ash::AcceleratorData& accel_data = ash::kAcceleratorData[i];
+ if (accel_data.keycode == accelerator.key_code() &&
+ accel_data.modifiers == accelerator.modifiers()) {
+ return true;
+ }
+ }
+#endif
+
+ std::vector<chrome::AcceleratorMapping> accelerators =
+ chrome::GetAcceleratorList();
+ for (std::vector<chrome::AcceleratorMapping>::const_iterator it =
+ accelerators.begin(); it != accelerators.end(); ++it) {
+ if (it->keycode == accelerator.key_code() &&
+ it->modifiers == accelerator.modifiers())
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698