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

Unified Diff: chrome/browser/extensions/api/push_messaging/push_messaging_api.cc

Issue 11682005: Remove some Profile-keyed factory boilerplate: management omnibox preference push_messaging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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/push_messaging/push_messaging_api.cc
diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
index 681be8669a4f540edfe3665b77e1423f4fe131b8..03db20b65bf4664fc9a90c726fea26b84aaf50c8 100644
--- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
+++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
@@ -7,15 +7,16 @@
#include <set>
#include "base/bind.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/values.h"
-#include "chrome/browser/extensions/api/push_messaging/push_messaging_api_factory.h"
#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h"
#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/extensions/extension_system_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
@@ -287,7 +288,7 @@ PushMessagingAPI::~PushMessagingAPI() {
// static
PushMessagingAPI* PushMessagingAPI::Get(Profile* profile) {
- return PushMessagingAPIFactory::GetForProfile(profile);
+ return ProfileKeyedAPIFactory<PushMessagingAPI>::GetForProfile(profile);
}
void PushMessagingAPI::Shutdown() {
@@ -298,4 +299,19 @@ PushMessagingEventRouter* PushMessagingAPI::GetEventRouterForTest() {
return push_messaging_event_router_.get();
}
+static base::LazyInstance<ProfileKeyedAPIFactory<PushMessagingAPI> >
+g_factory = LAZY_INSTANCE_INITIALIZER;
+
+template <>
+ProfileKeyedAPIFactory<PushMessagingAPI>*
+ProfileKeyedAPIFactory<PushMessagingAPI>::GetInstance() {
+ return &g_factory.Get();
+}
+
+template <>
+void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() {
+ DependsOn(ExtensionSystemFactory::GetInstance());
+ DependsOn(ProfileSyncServiceFactory::GetInstance());
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698