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

Unified Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.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/media_galleries_private/media_galleries_private_api.h
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
index c4c95483c6a5c62a673c712dbd773634f8701403..89b652d7fd3fb781e4a74cacdd87807f7e0f0661 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
@@ -8,10 +8,10 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/media_gallery/media_galleries_preferences.h"
-#include "chrome/browser/profiles/profile_keyed_service.h"
class FilePath;
class Profile;
@@ -23,7 +23,7 @@ class MediaGalleriesPrivateEventRouter;
// The profile-keyed service that manages the media galleries private extension
// API.
-class MediaGalleriesPrivateAPI : public ProfileKeyedService,
+class MediaGalleriesPrivateAPI : public ProfileKeyedAPI,
public EventRouter::Observer {
public:
explicit MediaGalleriesPrivateAPI(Profile* profile);
@@ -32,14 +32,28 @@ class MediaGalleriesPrivateAPI : public ProfileKeyedService,
// ProfileKeyedService implementation.
virtual void Shutdown() OVERRIDE;
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>* GetFactoryInstance();
+
+ // Convenience method to get the MediaGalleriesPrivateAPI for a profile.
+ static MediaGalleriesPrivateAPI* Get(Profile* profile);
+
// EventRouter::Observer implementation.
virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
MediaGalleriesPrivateEventRouter* GetEventRouter();
private:
+ friend class ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>;
+
void MaybeInitializeEventRouter();
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return "MediaGalleriesPrivateAPI";
+ }
+ static const bool kServiceIsNULLWhileTesting = true;
+
// Current profile.
Profile* profile_;

Powered by Google App Engine
This is Rietveld 408576698