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

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

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.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index ba37a10dd1986b28cf3c96a2b7a446c785dbb17a..5fc50beac68496e065d8084a6519d71a9fb8a191 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/commands/command_service.h"
+#include "base/lazy_instance.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_keybinding_registry.h"
@@ -51,6 +52,19 @@ CommandService::CommandService(Profile* profile)
CommandService::~CommandService() {
}
+static base::LazyInstance<ProfileKeyedAPIFactory<CommandService> >
+g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+ProfileKeyedAPIFactory<CommandService>* CommandService::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
+// static
+CommandService* CommandService::Get(Profile* profile) {
+ return ProfileKeyedAPIFactory<CommandService>::GetForProfile(profile);
+}
+
bool CommandService::GetBrowserActionCommand(
const std::string& extension_id,
QueryType type,

Powered by Google App Engine
This is Rietveld 408576698