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

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

Issue 11820041: Remove profile-keyed factory boilerplates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 11 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/command_service.h
diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h
index ce3ba5a7b78eac3380caff12fd4bfbca555dc2d0..294c3c5e5aa45a6f12ce0eb206504f0bbcdfc895 100644
--- a/chrome/browser/extensions/api/commands/command_service.h
+++ b/chrome/browser/extensions/api/commands/command_service.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/basictypes.h"
-#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/common/extensions/command.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/notification_details.h"
@@ -32,7 +32,7 @@ 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 CommandService : public ProfileKeyedService,
+class CommandService : public ProfileKeyedAPI,
public content::NotificationObserver {
public:
// An enum specifying whether to fetch all extension commands or only active
@@ -49,6 +49,12 @@ class CommandService : public ProfileKeyedService,
explicit CommandService(Profile* profile);
virtual ~CommandService();
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance();
+
+ // Convenience method to get the CommandService for a profile.
+ static CommandService* Get(Profile* profile);
+
// Gets the command (if any) for the browser action of an extension given
// its |extension_id|. The function consults the master list to see if
// the command is active. Returns false if the extension has no browser
@@ -123,6 +129,14 @@ class CommandService : public ProfileKeyedService,
const content::NotificationDetails& details) OVERRIDE;
private:
+ friend class ProfileKeyedAPIFactory<CommandService>;
+
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return "CommandService";
+ }
+ static const bool kServiceRedirectedInIncognito = true;
+
// An enum specifying the types of icons that can have a command.
enum ExtensionActionType {
BROWSER_ACTION,
« no previous file with comments | « chrome/browser/extensions/api/bookmarks/bookmarks_api.cc ('k') | chrome/browser/extensions/api/commands/command_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698