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..541e82db271dfe693d6a0125b62072e92aa86e79 100644 |
| --- a/chrome/browser/extensions/extension_commands_global_registry.cc |
| +++ b/chrome/browser/extensions/extension_commands_global_registry.cc |
| @@ -78,13 +78,19 @@ void ExtensionCommandsGlobalRegistry::AddExtensionKeybinding( |
| event_targets_[iter->second.accelerator()].push_back( |
| 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())) |
| + if (!extensions::CommandService::IsMediaKey(iter->second.accelerator())) { |
| + // Shortcuts except media keys have only one target in the list. See |
| + // comment about |event_targets_|. |
| DCHECK(event_targets_[iter->second.accelerator()].size() == 1); |
| + } else if (event_targets_[iter->second.accelerator()].size() > 1) { |
| + // Now the |iter->second.accelerator()| is one of the media keys, we have |
| + // registerd it successfully, so pass it by. |
| + continue; |
| + } |
| - GlobalShortcutListener::GetInstance()->RegisterAccelerator( |
| - iter->second.accelerator(), this); |
| + if (!GlobalShortcutListener::GetInstance()->RegisterAccelerator( |
| + iter->second.accelerator(), this)) |
|
zhchbin
2013/12/17 13:34:32
You may ask why I didn't call RegisterAccelerator
Finnur
2013/12/17 14:31:40
Wondering if this would be simpler (you'll need to
zhchbin
2013/12/17 15:15:46
Thanks very much!
In this case we should also pus
|
| + event_targets_.erase(iter->second.accelerator()); |
| } |
| } |