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

Unified Diff: chrome/browser/extensions/api/commands/extension_command_service.h

Issue 10383240: This adds a webui overlay on the extensions page for showing what Extension keybindings are active.… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/api/commands/extension_command_service.h
===================================================================
--- chrome/browser/extensions/api/commands/extension_command_service.h (revision 138124)
+++ chrome/browser/extensions/api/commands/extension_command_service.h (working copy)
@@ -20,16 +20,29 @@
class PrefService;
class Profile;
+namespace base {
+ class DictionaryValue;
+}
+
namespace ui {
class Accelerator;
}
+namespace extensions {
+
// This service keeps track of preferences related to extension commands
// (assigning initial keybindings on install and removing them on deletion
// and answers questions related to which commands are active.
class ExtensionCommandService : public ProfileKeyedService,
public content::NotificationObserver {
public:
+ // An enum specifying whether to fetch all extension commands or only active
+ // ones.
+ enum QueryType {
+ ALL,
+ ACTIVE_ONLY,
+ };
+
// Register prefs for keybinding.
static void RegisterUserPrefs(PrefService* user_prefs);
@@ -37,33 +50,36 @@
explicit ExtensionCommandService(Profile* profile);
virtual ~ExtensionCommandService();
- // Gets the active keybinding (if any) for the browser action of an extension
- // given its |extension_id|. The function consults the master list to see if
+ // Gets the keybinding (if any) for the browser action of an extension given
+ // its |extension_id|. The function consults the master list to see if
// the keybinding is active. Returns NULL if the extension has no browser
- // action or no active keybinding for it.
- const extensions::Command* GetActiveBrowserActionCommand(
- const std::string& extension_id);
+ // action. Returns NULL if the keybinding is not active and |type| requested
+ // is ACTIVE_ONLY.
+ const extensions::Command* GetBrowserActionCommand(
+ const std::string& extension_id, QueryType type);
- // Gets the active keybinding (if any) for the page action of an extension
- // given its |extension_id|. The function consults the master list to see if
- // the keybinding is active. Returns NULL if the extension has no page action
- // or no active keybinding for it.
- const extensions::Command* GetActivePageActionCommand(
- const std::string& extension_id);
+ // Gets the keybinding (if any) for the page action of an extension given
+ // its |extension_id|. The function consults the master list to see if
+ // the keybinding is active. Returns NULL if the extension has no page
+ // action. Returns NULL if the keybinding is not active and |type| requested
+ // is ACTIVE_ONLY.
+ const extensions::Command* GetPageActionCommand(
+ const std::string& extension_id, QueryType type);
// Gets the active keybinding (if any) for the named commands of an extension
// given its |extension_id|. The function consults the master list to see if
// the keybinding is active. Returns an empty map if the extension has no
- // named commands or no active keybinding for the commands.
- extensions::CommandMap GetActiveNamedCommands(
- const std::string& extension_id);
+ // named commands or no active named commands when |type| requested is
+ // ACTIVE_ONLY.
+ extensions::CommandMap GetNamedCommands(
+ const std::string& extension_id, QueryType type);
// Checks to see if a keybinding |accelerator| for a given |command_name| in
// an extension with id |extension_id| is registered as active (by consulting
// the master list in |user_prefs|).
bool IsKeybindingActive(const ui::Accelerator& accelerator,
- std::string extension_id,
- std::string command_name);
+ const std::string& extension_id,
+ const std::string& command_name) const;
// Records a keybinding |accelerator| as active for an extension with id
// |extension_id| and command with the name |command_name|. If
@@ -102,4 +118,6 @@
DISALLOW_COPY_AND_ASSIGN(ExtensionCommandService);
};
+} // namespace extensions
+
#endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_EXTENSION_COMMAND_SERVICE_H_
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/extensions/api/commands/extension_command_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698