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

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.h

Issue 93643002: Media Galleries: Add chrome.mediaGalleries.addUserSelectedFolder(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix selected folder name Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/media_galleries/media_galleries_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/extensions/chrome_extension_function.h" 15 #include "chrome/browser/extensions/chrome_extension_function.h"
15 #include "chrome/browser/media_galleries/media_file_system_registry.h" 16 #include "chrome/browser/media_galleries/media_file_system_registry.h"
16 #include "chrome/browser/storage_monitor/media_storage_util.h" 17 #include "chrome/browser/storage_monitor/media_storage_util.h"
17 #include "chrome/common/extensions/api/media_galleries.h" 18 #include "chrome/common/extensions/api/media_galleries.h"
18 19
19 namespace MediaGalleries = extensions::api::media_galleries; 20 namespace MediaGalleries = extensions::api::media_galleries;
20 21
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Bottom half for RunImpl, invoked after the preferences is initialized. 72 // Bottom half for RunImpl, invoked after the preferences is initialized.
72 // Gets the list of permitted galleries and checks if they are available. 73 // Gets the list of permitted galleries and checks if they are available.
73 void OnPreferencesInit(); 74 void OnPreferencesInit();
74 75
75 // Callback to run upon getting the list of available devices. 76 // Callback to run upon getting the list of available devices.
76 // Sends the list of media filesystem metadata back to the extension. 77 // Sends the list of media filesystem metadata back to the extension.
77 void OnGetGalleries(const MediaGalleryPrefIdSet& permitted_gallery_ids, 78 void OnGetGalleries(const MediaGalleryPrefIdSet& permitted_gallery_ids,
78 const MediaStorageUtil::DeviceIdSet* available_devices); 79 const MediaStorageUtil::DeviceIdSet* available_devices);
79 }; 80 };
80 81
82 class MediaGalleriesAddUserSelectedFolderFunction
83 : public ChromeAsyncExtensionFunction {
84 public:
85 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addUserSelectedFolder",
86 MEDIAGALLERIES_ADDUSERSELECTEDFOLDER)
87
88 protected:
89 virtual ~MediaGalleriesAddUserSelectedFolderFunction();
90 virtual bool RunImpl() OVERRIDE;
91
92 private:
93 // Bottom half for RunImpl, invoked after the preferences is initialized.
94 void OnPreferencesInit();
95
96 // Callback for the directory prompt request, with the input from the user.
97 // If |selected_directory| is empty, then the user canceled.
98 // Either handle the user canceled case or add the selected gallery.
99 void OnDirectorySelected(const base::FilePath& selected_directory);
100
101 // Callback for the directory prompt request. |pref_id| is for the gallery
102 // the user just added. |filesystems| is the entire list of file systems.
103 // The fsid for the file system that corresponds to |pref_id| will be
104 // appended to the list of file systems returned to the caller. The
105 // Javascript binding for this API will interpret the list appropriately.
106 void ReturnGalleriesAndId(
107 MediaGalleryPrefId pref_id,
108 const std::vector<MediaFileSystemInfo>& filesystems);
109
110 // A helper method that calls
111 // MediaFileSystemRegistry::GetMediaFileSystemsForExtension().
112 void GetMediaFileSystemsForExtension(const MediaFileSystemsCallback& cb);
113 };
114
81 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction { 115 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction {
82 public: 116 public:
83 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", 117 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata",
84 MEDIAGALLERIES_GETMETADATA) 118 MEDIAGALLERIES_GETMETADATA)
85 119
86 protected: 120 protected:
87 virtual ~MediaGalleriesGetMetadataFunction(); 121 virtual ~MediaGalleriesGetMetadataFunction();
88 virtual bool RunImpl() OVERRIDE; 122 virtual bool RunImpl() OVERRIDE;
89 123
90 private: 124 private:
91 // Bottom half for RunImpl, invoked after the preferences is initialized. 125 // Bottom half for RunImpl, invoked after the preferences is initialized.
92 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); 126 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid);
93 127
94 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header); 128 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header);
95 }; 129 };
96 130
97 } // namespace extensions 131 } // namespace extensions
98 132
99 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 133 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/media_galleries/media_galleries_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698