OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR IVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR IVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR IVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR IVATE_API_H_ |
7 | 7 |
8 #include <string> | |
9 | |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/event_router.h" | 11 #include "chrome/browser/extensions/event_router.h" |
12 #include "chrome/browser/extensions/extension_function.h" | |
13 #include "chrome/browser/media_gallery/media_galleries_preferences.h" | |
10 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
11 | 15 |
16 class FilePath; | |
17 class Profile; | |
18 | |
12 namespace extensions { | 19 namespace extensions { |
20 | |
21 class MediaGalleryExtensionNotificationObserver; | |
13 class MediaGalleriesPrivateEventRouter; | 22 class MediaGalleriesPrivateEventRouter; |
14 | 23 |
24 // The profile-keyed service that manages the media galleries private extension | |
25 // API. | |
15 class MediaGalleriesPrivateAPI : public ProfileKeyedService, | 26 class MediaGalleriesPrivateAPI : public ProfileKeyedService, |
16 public extensions::EventRouter::Observer { | 27 public EventRouter::Observer { |
17 public: | 28 public: |
18 explicit MediaGalleriesPrivateAPI(Profile* profile); | 29 explicit MediaGalleriesPrivateAPI(Profile* profile); |
19 virtual ~MediaGalleriesPrivateAPI(); | 30 virtual ~MediaGalleriesPrivateAPI(); |
20 | 31 |
21 // ProfileKeyedService implementation. | 32 // ProfileKeyedService implementation. |
22 virtual void Shutdown() OVERRIDE; | 33 virtual void Shutdown() OVERRIDE; |
23 | 34 |
24 // EventRouter::Observer implementation. | 35 // EventRouter::Observer implementation. |
25 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | 36 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
26 OVERRIDE; | 37 |
38 MediaGalleriesPrivateEventRouter* event_router(); | |
Lei Zhang
2013/01/04 22:56:28
nit: event_router -> GetEventRouter()
kmadhusu
2013/01/04 23:41:02
Done.
| |
27 | 39 |
28 private: | 40 private: |
41 // Current profile. | |
29 Profile* profile_; | 42 Profile* profile_; |
30 | 43 |
44 scoped_ptr<MediaGalleryExtensionNotificationObserver> | |
45 extension_notification_observer_; | |
46 | |
47 // Created lazily on first access. | |
31 scoped_ptr<MediaGalleriesPrivateEventRouter> | 48 scoped_ptr<MediaGalleriesPrivateEventRouter> |
32 media_galleries_private_event_router_; | 49 media_galleries_private_event_router_; |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateAPI); | |
52 }; | |
53 | |
54 // Implements the chrome.mediaGalleriesPrivate.addGalleryWatch method. | |
55 class MediaGalleriesPrivateAddGalleryWatchFunction | |
56 : public AsyncExtensionFunction { | |
57 public: | |
58 DECLARE_EXTENSION_FUNCTION_NAME("mediaGalleriesPrivate.addGalleryWatch"); | |
59 | |
60 protected: | |
61 virtual ~MediaGalleriesPrivateAddGalleryWatchFunction(); | |
62 | |
63 // AsyncExtensionFunction overrides. | |
64 virtual bool RunImpl() OVERRIDE; | |
65 | |
66 private: | |
67 // Gallery watch request handler. | |
68 void HandleResponse(chrome::MediaGalleryPrefId gallery_id, | |
69 bool success); | |
70 }; | |
71 | |
72 // Implements the chrome.mediaGalleriesPrivate.removeGalleryWatch method. | |
73 class MediaGalleriesPrivateRemoveGalleryWatchFunction | |
74 : public SyncExtensionFunction { | |
75 public: | |
76 DECLARE_EXTENSION_FUNCTION_NAME("mediaGalleriesPrivate.removeGalleryWatch"); | |
77 | |
78 protected: | |
79 virtual ~MediaGalleriesPrivateRemoveGalleryWatchFunction(); | |
80 | |
81 // SyncExtensionFunction overrides. | |
82 virtual bool RunImpl() OVERRIDE; | |
33 }; | 83 }; |
34 | 84 |
35 } // namespace extensions | 85 } // namespace extensions |
36 | 86 |
37 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES _PRIVATE_API_H_ | 87 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES _PRIVATE_API_H_ |
OLD | NEW |