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 // Use the <code>chrome.mediaGalleries</code> API to access media files (audio, | 5 // Use the <code>chrome.mediaGalleries</code> API to access media files (audio, |
6 // images, video) from the user's local disks (with the user's consent). | 6 // images, video) from the user's local disks (with the user's consent). |
7 namespace mediaGalleries { | 7 namespace mediaGalleries { |
8 | 8 |
9 [inline_doc] enum GalleryChangeType { | 9 [inline_doc] enum GalleryChangeType { |
10 // The contents of the gallery have changed. | 10 // The contents of the gallery have changed. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // stream order will be preserved. Container metadata is the first element. | 166 // stream order will be preserved. Container metadata is the first element. |
167 StreamInfo[] rawTags; | 167 StreamInfo[] rawTags; |
168 | 168 |
169 // The images embedded in the media file's metadata. This is most often | 169 // The images embedded in the media file's metadata. This is most often |
170 // used for album art or video thumbnails. | 170 // used for album art or video thumbnails. |
171 [instanceOf=Blob] object[] attachedImages; | 171 [instanceOf=Blob] object[] attachedImages; |
172 }; | 172 }; |
173 | 173 |
174 callback MediaMetadataCallback = void (MediaMetadata metadata); | 174 callback MediaMetadataCallback = void (MediaMetadata metadata); |
175 | 175 |
| 176 // A dictionary that describes the add gallery watch request results. |
| 177 dictionary AddGalleryWatchResult { |
| 178 DOMString galleryId; |
| 179 boolean success; |
| 180 }; |
| 181 |
| 182 callback AddGalleryWatchCallback = void (AddGalleryWatchResult result); |
| 183 callback GetAllGalleryWatchCallback = void (DOMString[] galleryIds); |
| 184 |
176 interface Functions { | 185 interface Functions { |
177 // Get the media galleries configured in this user agent. If none are | 186 // Get the media galleries configured in this user agent. If none are |
178 // configured or available, the callback will receive an empty array. | 187 // configured or available, the callback will receive an empty array. |
179 static void getMediaFileSystems(optional MediaFileSystemsDetails details, | 188 static void getMediaFileSystems(optional MediaFileSystemsDetails details, |
180 MediaFileSystemsCallback callback); | 189 MediaFileSystemsCallback callback); |
181 | 190 |
182 // Present a directory picker to the user and add the selected directory | 191 // Present a directory picker to the user and add the selected directory |
183 // as a gallery. If the user cancels the picker, selectedFileSystemName | 192 // as a gallery. If the user cancels the picker, selectedFileSystemName |
184 // will be empty. | 193 // will be empty. |
185 // A user gesture is required for the dialog to display. Without a user | 194 // A user gesture is required for the dialog to display. Without a user |
(...skipping 27 matching lines...) Expand all Loading... |
213 | 222 |
214 // Get metadata for all available media galleries. | 223 // Get metadata for all available media galleries. |
215 static void getAllMediaFileSystemMetadata( | 224 static void getAllMediaFileSystemMetadata( |
216 MediaFileSystemsMetadataCallback callback); | 225 MediaFileSystemsMetadataCallback callback); |
217 | 226 |
218 // Gets the media-specific metadata for a media file. This should work | 227 // Gets the media-specific metadata for a media file. This should work |
219 // for files in media galleries as well as other DOM filesystems. | 228 // for files in media galleries as well as other DOM filesystems. |
220 static void getMetadata([instanceOf=Blob] object mediaFile, | 229 static void getMetadata([instanceOf=Blob] object mediaFile, |
221 optional MediaMetadataOptions options, | 230 optional MediaMetadataOptions options, |
222 MediaMetadataCallback callback); | 231 MediaMetadataCallback callback); |
| 232 |
| 233 // Adds a gallery watch for the gallery with the specified gallery ID. |
| 234 // The given callback is then fired with a success or failure result. |
| 235 static void addGalleryWatch(DOMString galleryId, |
| 236 AddGalleryWatchCallback callback); |
| 237 |
| 238 // Removes a gallery watch for the gallery with the specified gallery ID. |
| 239 static void removeGalleryWatch(DOMString galleryId); |
| 240 |
| 241 // Notifies which galleries are being watched via the given callback. |
| 242 static void getAllGalleryWatch(GetAllGalleryWatchCallback callback); |
| 243 |
| 244 // Removes all gallery watches. |
| 245 static void removeAllGalleryWatch(); |
223 }; | 246 }; |
224 | 247 |
225 interface Events { | 248 interface Events { |
226 // Fired when a media gallery is changed or a gallery watch is dropped. | 249 // Fired when a media gallery is changed or a gallery watch is dropped. |
227 static void onGalleryChanged(GalleryChangeDetails details); | 250 static void onGalleryChanged(GalleryChangeDetails details); |
228 | 251 |
229 // The pending media scan has changed state. See details for more | 252 // The pending media scan has changed state. See details for more |
230 // information. | 253 // information. |
231 static void onScanProgress(ScanProgressDetails details); | 254 static void onScanProgress(ScanProgressDetails details); |
232 }; | 255 }; |
233 }; | 256 }; |
OLD | NEW |