- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / accelerator_utils_aura.cc
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