Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3001)

Unified Diff: chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc

Issue 23812010: Implement first part of supporting global extension commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gclient sync Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc
diff --git a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc
index ccb02561afeac1e141559ed15d34d2f2ba7b729d..4637dd0edc3491567730a7b296f65e4a79ad1631 100644
--- a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc
@@ -64,6 +64,7 @@ void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding(
command_service->GetNamedCommands(
extension->id(),
extensions::CommandService::ACTIVE_ONLY,
+ extensions::CommandService::REGULAR,
&commands);
for (extensions::CommandMap::const_iterator iter = commands.begin();
@@ -127,28 +128,16 @@ void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding(
}
}
-void ExtensionKeybindingRegistryGtk::RemoveExtensionKeybinding(
- const extensions::Extension* extension,
+void ExtensionKeybindingRegistryGtk::RemoveExtensionKeybindingImpl(
+ const ui::Accelerator& accelerator,
const std::string& command_name) {
- EventTargets::iterator iter = event_targets_.begin();
- while (iter != event_targets_.end()) {
- if (iter->second.first != extension->id() ||
- (!command_name.empty() && iter->second.second != command_name)) {
- ++iter;
- continue; // Not the extension or command we asked for.
- }
-
- // On GTK, unlike Windows, the Event Targets contain all events but we must
- // only unregister the ones we registered targets for.
- if (!ShouldIgnoreCommand(iter->second.second)) {
- gtk_accel_group_disconnect_key(
- accel_group_,
- ui::GetGdkKeyCodeForAccelerator(iter->first),
- ui::GetGdkModifierForAccelerator(iter->first));
- }
-
- EventTargets::iterator old = iter++;
- event_targets_.erase(old);
+ // On GTK, unlike Windows, the Event Targets contain all events but we must
+ // only unregister the ones we registered targets for.
+ if (!ShouldIgnoreCommand(command_name)) {
+ gtk_accel_group_disconnect_key(
+ accel_group_,
+ ui::GetGdkKeyCodeForAccelerator(accelerator),
+ ui::GetGdkModifierForAccelerator(accelerator));
}
}

Powered by Google App Engine
This is Rietveld 408576698