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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/profiles/profile.h"
6 #include "chrome/browser/ui/views/accelerator_table.h"
7 #include "ui/base/accelerators/accelerator.h"
8
9 #if defined(USE_ASH)
10 #include "ash/accelerators/accelerator_table.h"
11 #endif // USE_ASH
12
13 namespace chrome {
14
15 bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) {
16 #if defined(USE_ASH)
17 for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) {
18 const ash::AcceleratorData& accel_data = ash::kAcceleratorData[i];
19 if (accel_data.keycode == accelerator.key_code() &&
20 accel_data.modifiers == accelerator.modifiers()) {
21 return true;
22 }
23 }
24 #endif
25
26 std::vector<chrome::AcceleratorMapping> accelerators =
27 chrome::GetAcceleratorList();
28 for (std::vector<chrome::AcceleratorMapping>::const_iterator it =
29 accelerators.begin(); it != accelerators.end(); ++it) {
30 if (it->keycode == accelerator.key_code() &&
31 it->modifiers == accelerator.modifiers())
32 return true;
33 }
34
35 return false;
36 }
37
38 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698