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

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: rebase 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/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..e8bdc33d786ce7cc364c8555abcc72844d0e53ae 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,15 +288,30 @@ PushMessagingAPI::~PushMessagingAPI() {
// static
PushMessagingAPI* PushMessagingAPI::Get(Profile* profile) {
- return PushMessagingAPIFactory::GetForProfile(profile);
+ return ProfileKeyedAPIFactory<PushMessagingAPI>::GetForProfile(profile);
}
void PushMessagingAPI::Shutdown() {
push_messaging_event_router_.reset();
}
+static base::LazyInstance<ProfileKeyedAPIFactory<PushMessagingAPI> >
+g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+ProfileKeyedAPIFactory<PushMessagingAPI>*
+PushMessagingAPI::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
PushMessagingEventRouter* PushMessagingAPI::GetEventRouterForTest() {
return push_messaging_event_router_.get();
}
+template <>
+void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() {
+ DependsOn(ExtensionSystemFactory::GetInstance());
+ DependsOn(ProfileSyncServiceFactory::GetInstance());
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698