| 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 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "chrome/browser/extensions/extension_function.h" | 13 #include "chrome/browser/extensions/extension_function.h" |
| 14 #include "chrome/browser/media_gallery/media_file_system_registry.h" | 14 #include "chrome/browser/media_gallery/media_file_system_registry.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 class MediaGalleriesGetMediaFileSystemsFunction | 18 class MediaGalleriesGetMediaFileSystemsFunction |
| 19 : public AsyncExtensionFunction { | 19 : public AsyncExtensionFunction { |
| 20 public: | 20 public: |
| 21 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems", | 21 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems", |
| 22 MEDIAGALLERIES_GETMEDIAFILESYSTEMS) | 22 MEDIAGALLERIES_GETMEDIAFILESYSTEMS) |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual ~MediaGalleriesGetMediaFileSystemsFunction(); | 25 virtual ~MediaGalleriesGetMediaFileSystemsFunction(); |
| 26 virtual bool RunImpl() OVERRIDE; | 26 virtual bool RunImpl() OVERRIDE; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // Always show the dialog. |
| 30 void AlwaysShowDialog( |
| 31 const std::vector<chrome::MediaFileSystemInfo>& filesystems); |
| 32 |
| 29 // If no galleries are found, show the dialog, otherwise return them. | 33 // If no galleries are found, show the dialog, otherwise return them. |
| 30 void ShowDialogIfNoGalleries( | 34 void ShowDialogIfNoGalleries( |
| 31 const std::vector<chrome::MediaFileSystemInfo>& filesystems); | 35 const std::vector<chrome::MediaFileSystemInfo>& filesystems); |
| 32 | 36 |
| 33 // Grabs galleries from the media file system registry and passes them to | 37 // Grabs galleries from the media file system registry and passes them to |
| 34 // |ReturnGalleries|. | 38 // |ReturnGalleries|. |
| 35 void GetAndReturnGalleries(); | 39 void GetAndReturnGalleries(); |
| 36 | 40 |
| 37 // Returns galleries to the caller. | 41 // Returns galleries to the caller. |
| 38 void ReturnGalleries( | 42 void ReturnGalleries( |
| 39 const std::vector<chrome::MediaFileSystemInfo>& filesystems); | 43 const std::vector<chrome::MediaFileSystemInfo>& filesystems); |
| 40 | 44 |
| 41 // Shows the configuration dialog to edit gallery preferences. | 45 // Shows the configuration dialog to edit gallery preferences. |
| 42 void ShowDialog(); | 46 void ShowDialog(); |
| 47 |
| 48 // A helper method that calls |
| 49 // MediaFileSystemRegistry::GetMediaFileSystemsForExtension(). |
| 50 void GetMediaFileSystemsForExtension( |
| 51 const chrome::MediaFileSystemsCallback& cb); |
| 43 }; | 52 }; |
| 44 | 53 |
| 45 class MediaGalleriesAssembleMediaFileFunction : public SyncExtensionFunction { | 54 class MediaGalleriesAssembleMediaFileFunction : public SyncExtensionFunction { |
| 46 public: | 55 public: |
| 47 DECLARE_EXTENSION_FUNCTION( | 56 DECLARE_EXTENSION_FUNCTION( |
| 48 "experimental.mediaGalleries.assembleMediaFile", | 57 "experimental.mediaGalleries.assembleMediaFile", |
| 49 EXPERIMENTAL_MEDIAGALLERIES_ASSEMBLEMEDIAFILE) | 58 EXPERIMENTAL_MEDIAGALLERIES_ASSEMBLEMEDIAFILE) |
| 50 | 59 |
| 51 protected: | 60 protected: |
| 52 virtual ~MediaGalleriesAssembleMediaFileFunction(); | 61 virtual ~MediaGalleriesAssembleMediaFileFunction(); |
| 53 virtual bool RunImpl() OVERRIDE; | 62 virtual bool RunImpl() OVERRIDE; |
| 54 }; | 63 }; |
| 55 | 64 |
| 56 } // namespace extensions | 65 } // namespace extensions |
| 57 | 66 |
| 58 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 67 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
| OLD | NEW |