OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 #include "chrome/browser/ui/host_desktop.h" | 6 #include "chrome/browser/ui/host_desktop.h" |
7 #include "chrome/browser/ui/views/accelerator_table.h" | 7 #include "chrome/browser/ui/views/accelerator_table.h" |
8 #include "ui/base/accelerators/accelerator.h" | 8 #include "ui/base/accelerators/accelerator.h" |
9 | 9 |
10 #if defined(USE_ASH) | 10 #if defined(USE_ASH) |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (it->keycode == accelerator.key_code() && | 31 if (it->keycode == accelerator.key_code() && |
32 it->modifiers == accelerator.modifiers()) | 32 it->modifiers == accelerator.modifiers()) |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 return false; | 36 return false; |
37 } | 37 } |
38 | 38 |
39 ui::Accelerator GetPrimaryChromeAcceleratorForCommandId(int command_id) { | 39 ui::Accelerator GetPrimaryChromeAcceleratorForCommandId(int command_id) { |
40 ui::Accelerator accelerator; | 40 ui::Accelerator accelerator; |
41 // GetAshAcceleratorForCommandId with HOST_DESKTOP_TYPE_ASH is used so we can | 41 // GetAshAcceleratorForCommandId with ui::HOST_DESKTOP_TYPE_ASH is used so we |
| 42 // can |
42 // find Ash accelerators if Ash is supported on this platform, even if it's | 43 // find Ash accelerators if Ash is supported on this platform, even if it's |
43 // not currently in use. | 44 // not currently in use. |
44 if (GetStandardAcceleratorForCommandId(command_id, &accelerator) || | 45 if (GetStandardAcceleratorForCommandId(command_id, &accelerator) || |
45 GetAshAcceleratorForCommandId(command_id, | 46 GetAshAcceleratorForCommandId(command_id, ui::HOST_DESKTOP_TYPE_ASH, |
46 HOST_DESKTOP_TYPE_ASH, | |
47 &accelerator)) { | 47 &accelerator)) { |
48 return accelerator; | 48 return accelerator; |
49 } | 49 } |
50 | 50 |
51 std::vector<chrome::AcceleratorMapping> accelerators = | 51 std::vector<chrome::AcceleratorMapping> accelerators = |
52 chrome::GetAcceleratorList(); | 52 chrome::GetAcceleratorList(); |
53 for (size_t i = 0; i < accelerators.size(); ++i) { | 53 for (size_t i = 0; i < accelerators.size(); ++i) { |
54 if (accelerators[i].command_id == command_id) { | 54 if (accelerators[i].command_id == command_id) { |
55 return ui::Accelerator(accelerators[i].keycode, | 55 return ui::Accelerator(accelerators[i].keycode, |
56 accelerators[i].modifiers); | 56 accelerators[i].modifiers); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 return ui::Accelerator(); | 60 return ui::Accelerator(); |
61 } | 61 } |
62 | 62 |
63 } // namespace chrome | 63 } // namespace chrome |
OLD | NEW |