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

Unified Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.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/media_galleries_private/media_galleries_private_api.cc
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
index dd30f7e80775b93d52a4694765f635d96a3ddeff..7209d113f7b1c63902c01b398ce6b0fbee68acf4 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
@@ -7,11 +7,11 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/file_path.h"
+#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/string_number_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.h"
-#include "chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api_factory.h"
#include "chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h"
#include "chrome/browser/extensions/api/media_galleries_private/media_gallery_extension_notification_observer.h"
#include "chrome/browser/extensions/event_names.h"
@@ -129,6 +129,21 @@ void MediaGalleriesPrivateAPI::Shutdown() {
base::Bind(&HandleProfileShutdownOnFileThread, profile_));
}
+static base::LazyInstance<ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI> >
+g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>*
+ MediaGalleriesPrivateAPI::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
+// static
+MediaGalleriesPrivateAPI* MediaGalleriesPrivateAPI::Get(Profile* profile) {
+ return
+ ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>::GetForProfile(profile);
+}
+
void MediaGalleriesPrivateAPI::OnListenerAdded(
const EventListenerInfo& details) {
// Try to initialize the event router for the listener. If
@@ -183,8 +198,7 @@ bool MediaGalleriesPrivateAddGalleryWatchFunction::RunImpl() {
#if defined(OS_WIN)
MediaGalleriesPrivateEventRouter* router =
- MediaGalleriesPrivateAPIFactory::GetForProfile(
- profile_)->GetEventRouter();
+ MediaGalleriesPrivateAPI::Get(profile_)->GetEventRouter();
DCHECK(router);
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,

Powered by Google App Engine
This is Rietveld 408576698