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

Unified Diff: chrome/browser/extensions/extension_keybinding_registry.h

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/extensions/extension_keybinding_registry.h
diff --git a/chrome/browser/extensions/extension_keybinding_registry.h b/chrome/browser/extensions/extension_keybinding_registry.h
index 7acd7f53784c59cf1396507da80cb6d0c5369212..723a6bbbc712eaade3479a492d68cd6e37db006a 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.h
+++ b/chrome/browser/extensions/extension_keybinding_registry.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
+#include <map>
#include <string>
#include "base/compiler_specific.h"
@@ -15,6 +16,10 @@
class Profile;
+namespace ui {
+class Accelerator;
+}
+
namespace extensions {
class ActiveTabPermissionGranter;
@@ -63,8 +68,13 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver {
const std::string& command_name) = 0;
// Remove extension bindings for |extension|. |command_name| is optional,
// but if not blank then only the command specified will be removed.
- virtual void RemoveExtensionKeybinding(
+ void RemoveExtensionKeybinding(
const Extension* extension,
+ const std::string& command_name);
+ // Overridden by platform specific implementations to provide additional
+ // unregistration (which varies between platforms).
+ virtual void RemoveExtensionKeybindingImpl(
+ const ui::Accelerator& accelerator,
const std::string& command_name) = 0;
// Make sure all extensions registered have keybindings added.
@@ -78,6 +88,15 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver {
void CommandExecuted(const std::string& extension_id,
const std::string& command);
+ // Maps an accelerator to a string pair (extension id, command name) for
+ // commands that have been registered. This keeps track of the targets for the
+ // keybinding event (which named command to call in which extension). On GTK,
+ // this map contains registration for pageAction and browserAction commands,
+ // whereas on other platforms it does not.
+ typedef std::map< ui::Accelerator,
+ std::pair<std::string, std::string> > EventTargets;
+ EventTargets event_targets_;
+
private:
// Returns true if the |extension| matches our extension filter.
bool ExtensionMatchesFilter(const extensions::Extension* extension);

Powered by Google App Engine
This is Rietveld 408576698