| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/accelerator_table.h" | 5 #include "chrome/browser/ui/views/accelerator_table.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "ui/base/accelerators/accelerator.h" | 9 #include "ui/base/accelerators/accelerator.h" |
| 10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 #endif // defined(USE_ASH) | 224 #endif // defined(USE_ASH) |
| 225 | 225 |
| 226 } // namespace | 226 } // namespace |
| 227 | 227 |
| 228 std::vector<AcceleratorMapping> GetAcceleratorList() { | 228 std::vector<AcceleratorMapping> GetAcceleratorList() { |
| 229 return std::vector<AcceleratorMapping>( | 229 return std::vector<AcceleratorMapping>( |
| 230 kAcceleratorMap, kAcceleratorMap + kAcceleratorMapLength); | 230 kAcceleratorMap, kAcceleratorMap + kAcceleratorMapLength); |
| 231 } | 231 } |
| 232 | 232 |
| 233 bool GetAshAcceleratorForCommandId(int command_id, | 233 bool GetAshAcceleratorForCommandId(int command_id, |
| 234 HostDesktopType host_desktop_type, | 234 ui::HostDesktopType host_desktop_type, |
| 235 ui::Accelerator* accelerator) { | 235 ui::Accelerator* accelerator) { |
| 236 #if defined(USE_ASH) | 236 #if defined(USE_ASH) |
| 237 if (host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) | 237 if (host_desktop_type != ui::HOST_DESKTOP_TYPE_ASH) |
| 238 return false; | 238 return false; |
| 239 for (size_t i = 0; i < kChromeCmdId2AshActionIdLength; ++i) { | 239 for (size_t i = 0; i < kChromeCmdId2AshActionIdLength; ++i) { |
| 240 if (command_id == kChromeCmdId2AshActionId[i].chrome_cmd_id) { | 240 if (command_id == kChromeCmdId2AshActionId[i].chrome_cmd_id) { |
| 241 for (size_t j = 0; j < ash::kAcceleratorDataLength; ++j) { | 241 for (size_t j = 0; j < ash::kAcceleratorDataLength; ++j) { |
| 242 if (kChromeCmdId2AshActionId[i].ash_action_id == | 242 if (kChromeCmdId2AshActionId[i].ash_action_id == |
| 243 ash::kAcceleratorData[j].action) { | 243 ash::kAcceleratorData[j].action) { |
| 244 *accelerator = ui::Accelerator(ash::kAcceleratorData[j].keycode, | 244 *accelerator = ui::Accelerator(ash::kAcceleratorData[j].keycode, |
| 245 ash::kAcceleratorData[j].modifiers); | 245 ash::kAcceleratorData[j].modifiers); |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 264 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); | 264 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); |
| 265 return true; | 265 return true; |
| 266 case IDC_PASTE: | 266 case IDC_PASTE: |
| 267 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); | 267 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace chrome | 273 } // namespace chrome |
| OLD | NEW |