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

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

Issue 10880064: Make extension commands grant the activeTab permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 3 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 68ad6a2f2ffc9d7cddd3c562f32c68fcd8702a32..7acd7f53784c59cf1396507da80cb6d0c5369212 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.h
+++ b/chrome/browser/extensions/extension_keybinding_registry.h
@@ -17,6 +17,7 @@ class Profile;
namespace extensions {
+class ActiveTabPermissionGranter;
class Extension;
// The ExtensionKeybindingRegistry is a class that handles the cross-platform
@@ -24,15 +25,24 @@ class Extension;
// implementation details for each platform.
class ExtensionKeybindingRegistry : public content::NotificationObserver {
public:
- enum ExtensionFilter {
- ALL_EXTENSIONS,
- PLATFORM_APPS_ONLY
- };
-
- // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by
+ enum ExtensionFilter {
+ ALL_EXTENSIONS,
+ PLATFORM_APPS_ONLY
+ };
+
+ class Delegate {
+ public:
+ // Gets the ActiveTabPermissionGranter for the active tab, if any.
+ // If there is no active tab then returns NULL.
+ virtual ActiveTabPermissionGranter* GetActiveTabPermissionGranter() = 0;
+ };
+
+ // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by
// by extensions that match the filter will be registered.
ExtensionKeybindingRegistry(Profile* profile,
- ExtensionFilter extension_filter);
+ ExtensionFilter extension_filter,
+ Delegate* delegate);
+
virtual ~ExtensionKeybindingRegistry();
// Enables/Disables general shortcut handing in Chrome. Implemented in
@@ -64,6 +74,10 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver {
// commands are currently ignored, since they are handled elsewhere.
bool ShouldIgnoreCommand(const std::string& command) const;
+ // Notifies appropriate parties that a command has been executed.
+ void CommandExecuted(const std::string& extension_id,
+ const std::string& command);
+
private:
// Returns true if the |extension| matches our extension filter.
bool ExtensionMatchesFilter(const extensions::Extension* extension);
@@ -77,6 +91,9 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver {
// What extensions to register keybindings for.
ExtensionFilter extension_filter_;
+ // Weak pointer to our delegate. Not owned by us. Must outlive this class.
+ Delegate* delegate_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry);
};
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_apitest.cc ('k') | chrome/browser/extensions/extension_keybinding_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698