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 // Defines the Chrome Extensions Media Galleries API functions for accessing | 5 // Defines the Chrome Extensions Media Galleries API functions for accessing |
6 // user's media files, as specified in the extension API IDL. | 6 // user's media files, as specified in the extension API IDL. |
7 | 7 |
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 public MediaScanManagerObserver { | 30 public MediaScanManagerObserver { |
31 public: | 31 public: |
32 // BrowserContextKeyedService implementation. | 32 // BrowserContextKeyedService implementation. |
33 virtual void Shutdown() OVERRIDE; | 33 virtual void Shutdown() OVERRIDE; |
34 | 34 |
35 // ProfileKeyedAPI implementation. | 35 // ProfileKeyedAPI implementation. |
36 static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* | 36 static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* |
37 GetFactoryInstance(); | 37 GetFactoryInstance(); |
38 | 38 |
39 // Convenience method to get the MediaGalleriesAPI for a profile. | 39 // Convenience method to get the MediaGalleriesAPI for a profile. |
40 static MediaGalleriesEventRouter* Get(Profile* profile); | 40 static MediaGalleriesEventRouter* Get(content::BrowserContext* context); |
41 | 41 |
42 bool ExtensionHasScanProgressListener(const std::string& extension_id) const; | 42 bool ExtensionHasScanProgressListener(const std::string& extension_id) const; |
43 | 43 |
44 // MediaScanManagerObserver implementation. | 44 // MediaScanManagerObserver implementation. |
45 virtual void OnScanStarted(const std::string& extension_id) OVERRIDE; | 45 virtual void OnScanStarted(const std::string& extension_id) OVERRIDE; |
46 virtual void OnScanCancelled(const std::string& extension_id) OVERRIDE; | 46 virtual void OnScanCancelled(const std::string& extension_id) OVERRIDE; |
47 virtual void OnScanFinished( | 47 virtual void OnScanFinished( |
48 const std::string& extension_id, | 48 const std::string& extension_id, |
49 int gallery_count, | 49 int gallery_count, |
50 const MediaGalleryScanResult& file_counts) OVERRIDE; | 50 const MediaGalleryScanResult& file_counts) OVERRIDE; |
51 virtual void OnScanError(const std::string& extension_id) OVERRIDE; | 51 virtual void OnScanError(const std::string& extension_id) OVERRIDE; |
52 | 52 |
53 private: | 53 private: |
54 friend class ProfileKeyedAPIFactory<MediaGalleriesEventRouter>; | 54 friend class ProfileKeyedAPIFactory<MediaGalleriesEventRouter>; |
55 | 55 |
56 void DispatchEventToExtension(const std::string& extension_id, | 56 void DispatchEventToExtension(const std::string& extension_id, |
57 const std::string& event_name, | 57 const std::string& event_name, |
58 scoped_ptr<base::ListValue> event_args); | 58 scoped_ptr<base::ListValue> event_args); |
59 | 59 |
60 explicit MediaGalleriesEventRouter(Profile* profile); | 60 explicit MediaGalleriesEventRouter(content::BrowserContext* context); |
61 virtual ~MediaGalleriesEventRouter(); | 61 virtual ~MediaGalleriesEventRouter(); |
62 | 62 |
63 // ProfileKeyedAPI implementation. | 63 // ProfileKeyedAPI implementation. |
64 static const char* service_name() { | 64 static const char* service_name() { |
65 return "MediaGalleriesAPI"; | 65 return "MediaGalleriesAPI"; |
66 } | 66 } |
67 static const bool kServiceIsNULLWhileTesting = true; | 67 static const bool kServiceIsNULLWhileTesting = true; |
68 | 68 |
69 // Current profile. | 69 // Current profile. |
70 Profile* profile_; | 70 Profile* profile_; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Bottom half for RunImpl, invoked after the preferences is initialized. | 230 // Bottom half for RunImpl, invoked after the preferences is initialized. |
231 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); | 231 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); |
232 | 232 |
233 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header, | 233 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header, |
234 int64 total_blob_length); | 234 int64 total_blob_length); |
235 }; | 235 }; |
236 | 236 |
237 } // namespace extensions | 237 } // namespace extensions |
238 | 238 |
239 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 239 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
OLD | NEW |