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

Unified Diff: chrome/browser/extensions/api/commands/command_service.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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/commands/command_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/commands/command_service.h
diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h
index d857eb73e603c7850b8f7affad893e2f8dc5f524..ac553aa318c1a4464449ffccd543ae1e6ee10678 100644
--- a/chrome/browser/extensions/api/commands/command_service.h
+++ b/chrome/browser/extensions/api/commands/command_service.h
@@ -45,6 +45,15 @@ class CommandService : public ProfileKeyedAPI,
ACTIVE_ONLY,
};
+ // An enum specifying whether the command is global in scope or not. Global
+ // commands -- unlike regular commands -- have a global keyboard hook
+ // associated with them (and therefore work when Chrome doesn't have focus).
+ enum CommandScope {
+ REGULAR, // Regular (non-globally scoped) command.
+ GLOBAL, // Global command (works when Chrome doesn't have focus)
+ ANY_SCOPE, // All commands, regardless of scope (used when querying).
+ };
+
// Register prefs for keybinding.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -94,10 +103,11 @@ class CommandService : public ProfileKeyedAPI,
// Gets the active command (if any) for the named commands of an extension
// given its |extension_id|. The function consults the master list to see if
// the command is active. Returns an empty map if the extension has no
- // named commands or no active named commands when |type| requested is
- // ACTIVE_ONLY.
+ // named commands of the right |scope| or no such active named commands when
+ // |type| requested is ACTIVE_ONLY.
bool GetNamedCommands(const std::string& extension_id,
QueryType type,
+ CommandScope scope,
extensions::CommandMap* command_map);
// Records a keybinding |accelerator| as active for an extension with id
@@ -175,6 +185,9 @@ class CommandService : public ProfileKeyedAPI,
DISALLOW_COPY_AND_ASSIGN(CommandService);
};
+template <>
+void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies();
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/api/commands/command_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698