Chromium Code Reviews| Index: chrome/browser/extensions/extension_commands_global_registry.cc |
| diff --git a/chrome/browser/extensions/extension_commands_global_registry.cc b/chrome/browser/extensions/extension_commands_global_registry.cc |
| index aa11b9c5c5cf667de5a315d7573ae6d1bb1fc478..81a5c3ea3ce7650a75cbc2f806aec6cb7bf70656 100644 |
| --- a/chrome/browser/extensions/extension_commands_global_registry.cc |
| +++ b/chrome/browser/extensions/extension_commands_global_registry.cc |
| @@ -71,20 +71,24 @@ void ExtensionCommandsGlobalRegistry::AddExtensionKeybinding( |
| for (; iter != commands.end(); ++iter) { |
| if (!command_name.empty() && (iter->second.command_name() != command_name)) |
| continue; |
| + const ui::Accelerator& accelerator = iter->second.accelerator(); |
| VLOG(0) << "Adding global keybinding for " << extension->name().c_str() |
| << " " << command_name.c_str() |
| - << " key: " << iter->second.accelerator().GetShortcutText(); |
| + << " key: " << accelerator.GetShortcutText(); |
| - event_targets_[iter->second.accelerator()].push_back( |
| + if (event_targets_.find(accelerator) == event_targets_.end()) { |
| + if (!GlobalShortcutListener::GetInstance()->RegisterAccelerator( |
| + accelerator, this)) |
| + continue; |
| + } |
| + |
| + event_targets_[accelerator].push_back( |
|
Mark Mentovai
2013/12/19 18:00:29
Protected data members that are maintained by a cl
Finnur
2013/12/19 19:59:13
Glad you are reviewing this... :)
I guess the sup
Mark Mentovai
2013/12/19 20:15:43
Finnur wrote:
|
| std::make_pair(extension->id(), iter->second.command_name())); |
| // Shortcuts except media keys have only one target in the list. See comment |
| // about |event_targets_|. |
| - if (!extensions::CommandService::IsMediaKey(iter->second.accelerator())) |
| - DCHECK(event_targets_[iter->second.accelerator()].size() == 1); |
| - |
| - GlobalShortcutListener::GetInstance()->RegisterAccelerator( |
| - iter->second.accelerator(), this); |
| + if (!extensions::CommandService::IsMediaKey(accelerator)) |
| + DCHECK_EQ(1u, event_targets_[accelerator].size()); |
|
Mark Mentovai
2013/12/19 15:24:13
Is this the only check for multiple registration o
Finnur
2013/12/19 15:40:40
When you set a shortcut the current code removes t
Mark Mentovai
2013/12/19 18:00:29
Finnur wrote:
|
| } |
| } |