Chromium Code Reviews| Index: chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc |
| =================================================================== |
| --- chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc (revision 144430) |
| +++ chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc (working copy) |
| @@ -54,7 +54,8 @@ |
| } |
| void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding( |
| - const extensions::Extension* extension) { |
| + const extensions::Extension* extension, |
| + const std::string& command_name) { |
| extensions::CommandService* command_service = |
| extensions::CommandServiceFactory::GetForProfile(profile_); |
| extensions::CommandMap commands; |
| @@ -67,6 +68,9 @@ |
| extensions::CommandMap::const_iterator iter = commands.begin(); |
|
Evan Stade
2012/06/29 18:39:07
this should be inside the for statement
|
| for (; iter != commands.end(); ++iter) { |
| + if (!command_name.empty() && (iter->second.command_name() != command_name)) |
|
Yoyo Zhou
2012/06/28 22:40:51
Would it make any sense to do this instead in GetN
Finnur
2012/06/28 22:49:01
Maybe. I'll take a look tomorrow. If it does I mig
|
| + continue; |
| + |
| ui::AcceleratorGtk accelerator(iter->second.accelerator().key_code(), |
| iter->second.accelerator().IsShiftDown(), |
| iter->second.accelerator().IsCtrlDown(), |
| @@ -120,12 +124,14 @@ |
| } |
| void ExtensionKeybindingRegistryGtk::RemoveExtensionKeybinding( |
| - const extensions::Extension* extension) { |
| + const extensions::Extension* extension, |
| + const std::string& command_name) { |
| EventTargets::iterator iter = event_targets_.begin(); |
| while (iter != event_targets_.end()) { |
| - if (iter->second.first != extension->id()) { |
| + if (iter->second.first != extension->id() || |
| + (!command_name.empty() && (iter->second.second != command_name))) { |
|
Evan Stade
2012/06/29 18:39:07
don't need these parens around the != clause
|
| ++iter; |
| - continue; // Not the extension we asked for. |
| + continue; // Not the extension or command we asked for. |
| } |
| // On GTK, unlike Windows, the Event Targets contain all events but we must |