Chromium Code Reviews| 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/extensions/extension_keybinding_registry_views .h" | 5 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/commands/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 8 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 8 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/views/accelerator_table.h" | |
| 11 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 12 #include "ui/views/focus/focus_manager.h" | 13 #include "ui/views/focus/focus_manager.h" |
| 13 | 14 |
| 14 // static | 15 // static |
| 15 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( | 16 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( |
| 16 bool suspended) { | 17 bool suspended) { |
| 17 views::FocusManager::set_shortcut_handling_suspended(suspended); | 18 views::FocusManager::set_shortcut_handling_suspended(suspended); |
| 18 } | 19 } |
| 19 | 20 |
| 21 // static | |
| 22 bool extensions::ExtensionKeybindingRegistry::IsChromeAccelerator( | |
| 23 const ui::Accelerator& accelerator) { | |
| 24 std::vector<chrome::AcceleratorMapping> accelerators = | |
| 25 chrome::GetAcceleratorList(); | |
|
sky
2013/04/09 16:38:01
This is only applicable to aura and I don't know t
| |
| 26 for (std::vector<chrome::AcceleratorMapping>::const_iterator it = | |
| 27 accelerators.begin(); it != accelerators.end(); ++it) { | |
| 28 if (it->keycode == accelerator.key_code() && | |
| 29 it->modifiers == accelerator.modifiers()) | |
| 30 return true; | |
| 31 } | |
| 32 return false; | |
| 33 } | |
| 34 | |
| 20 ExtensionKeybindingRegistryViews::ExtensionKeybindingRegistryViews( | 35 ExtensionKeybindingRegistryViews::ExtensionKeybindingRegistryViews( |
| 21 Profile* profile, | 36 Profile* profile, |
| 22 views::FocusManager* focus_manager, | 37 views::FocusManager* focus_manager, |
| 23 ExtensionFilter extension_filter, | 38 ExtensionFilter extension_filter, |
| 24 Delegate* delegate) | 39 Delegate* delegate) |
| 25 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), | 40 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), |
| 26 profile_(profile), | 41 profile_(profile), |
| 27 focus_manager_(focus_manager) { | 42 focus_manager_(focus_manager) { |
| 28 Init(); | 43 Init(); |
| 29 } | 44 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 } | 108 } |
| 94 | 109 |
| 95 CommandExecuted(it->second.first, it->second.second); | 110 CommandExecuted(it->second.first, it->second.second); |
| 96 | 111 |
| 97 return true; | 112 return true; |
| 98 } | 113 } |
| 99 | 114 |
| 100 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { | 115 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { |
| 101 return true; | 116 return true; |
| 102 } | 117 } |
| OLD | NEW |