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

Unified Diff: chrome/browser/ui/views/extensions/extension_keybinding_registry_views.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/views/extensions/extension_keybinding_registry_views.cc
diff --git a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc
index 1531847118ccc1914d64dc2bafac94b97d16b4ba..61f49150a6a8c2eb98b361d113bac9fc83d68e27 100644
--- a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc
+++ b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc
@@ -47,7 +47,10 @@ void ExtensionKeybindingRegistryViews::AddExtensionKeybinding(
// which are handled elsewhere).
extensions::CommandMap commands;
if (!command_service->GetNamedCommands(
- extension->id(), extensions::CommandService::ACTIVE_ONLY, &commands))
+ extension->id(),
+ extensions::CommandService::ACTIVE_ONLY,
+ extensions::CommandService::REGULAR,
+ &commands))
return;
extensions::CommandMap::const_iterator iter = commands.begin();
for (; iter != commands.end(); ++iter) {
@@ -62,26 +65,10 @@ void ExtensionKeybindingRegistryViews::AddExtensionKeybinding(
}
}
-void ExtensionKeybindingRegistryViews::RemoveExtensionKeybinding(
- const extensions::Extension* extension,
+void ExtensionKeybindingRegistryViews::RemoveExtensionKeybindingImpl(
+ const ui::Accelerator& accelerator,
const std::string& command_name) {
- // This object only handles named commands, not browser/page actions.
- if (ShouldIgnoreCommand(command_name))
- return;
-
- 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.
- }
-
- focus_manager_->UnregisterAccelerator(iter->first, this);
-
- EventTargets::iterator old = iter++;
- event_targets_.erase(old);
- }
+ focus_manager_->UnregisterAccelerator(accelerator, this);
}
bool ExtensionKeybindingRegistryViews::AcceleratorPressed(

Powered by Google App Engine
This is Rietveld 408576698