Chromium Code Reviews| 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 454bf4f6122ec15a17f73ffb5f90ceb7a82c0d45..44f0f907d0dae7b596a61684bb4dcfa107fba6f0 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 |
| @@ -5,15 +5,25 @@ |
| #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PRIVATE_API_H_ |
| #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PRIVATE_API_H_ |
| +#include <string> |
| + |
| #include "base/memory/scoped_ptr.h" |
| #include "chrome/browser/extensions/event_router.h" |
| +#include "chrome/browser/extensions/extension_function.h" |
| #include "chrome/browser/profiles/profile_keyed_service.h" |
| +class FilePath; |
| +class Profile; |
| + |
| namespace extensions { |
| + |
| +class MediaGalleryExtensionNotificationObserver; |
| class MediaGalleriesPrivateEventRouter; |
| +// The profile-keyed service that manages the media galleries private extension |
| +// API. |
| class MediaGalleriesPrivateAPI : public ProfileKeyedService, |
| - public extensions::EventRouter::Observer { |
| + public EventRouter::Observer { |
| public: |
| explicit MediaGalleriesPrivateAPI(Profile* profile); |
| virtual ~MediaGalleriesPrivateAPI(); |
| @@ -22,14 +32,54 @@ class MediaGalleriesPrivateAPI : public ProfileKeyedService, |
| virtual void Shutdown() OVERRIDE; |
| // EventRouter::Observer implementation. |
| - virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
| - OVERRIDE; |
| + virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
| + |
| + MediaGalleriesPrivateEventRouter* event_router() const { |
| + return media_galleries_private_event_router_.get(); |
| + } |
| private: |
| + // Current profile. |
| Profile* profile_; |
| + scoped_ptr<MediaGalleryExtensionNotificationObserver> |
| + extension_notification_observer_; |
| + |
| + // Created lazily on first access. |
| scoped_ptr<MediaGalleriesPrivateEventRouter> |
| media_galleries_private_event_router_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateAPI); |
| +}; |
| + |
| +// Implements the chrome.mediaGalleriesPrivate.addGalleryWatch method. |
| +class MediaGalleriesPrivateAddGalleryWatchFunction |
| + : public AsyncExtensionFunction { |
| + public: |
| + DECLARE_EXTENSION_FUNCTION_NAME("mediaGalleriesPrivate.addGalleryWatch"); |
| + |
| + protected: |
| + virtual ~MediaGalleriesPrivateAddGalleryWatchFunction() {} |
|
Lei Zhang
2012/12/18 00:47:01
Put the implementation in the .cc file. Same for r
kmadhusu
2012/12/18 21:32:39
Done.
|
| + |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + |
| + // Gallery watch request handler. |
| + void HandleResponse(const std::string& gallery_id, |
|
Lei Zhang
2012/12/18 00:47:01
This can be private I think.
kmadhusu
2012/12/18 21:32:39
Done.
|
| + bool success); |
| +}; |
| + |
| +// Implements the chrome.mediaGalleriesPrivate.removeGalleryWatch method. |
| +class MediaGalleriesPrivateRemoveGalleryWatchFunction |
| + : public SyncExtensionFunction { |
| + public: |
| + DECLARE_EXTENSION_FUNCTION_NAME("mediaGalleriesPrivate.removeGalleryWatch"); |
| + |
| + protected: |
| + virtual ~MediaGalleriesPrivateRemoveGalleryWatchFunction() {} |
| + |
| + // SyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| }; |
| } // namespace extensions |