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 (images, | 5 // Use the <code>chrome.mediaGalleries</code> API to access media files (images, |
6 // video, audio) from the user's local disks (with the user's consent). | 6 // video, audio) from the user's local disks (with the user's consent). |
7 namespace mediaGalleries { | 7 namespace mediaGalleries { |
8 | 8 |
9 [inline_doc] enum GetMediaFileSystemsInteractivity { | 9 [inline_doc] enum GetMediaFileSystemsInteractivity { |
10 // Do not act interactively. | 10 // Do not act interactively. |
11 no, | 11 no, |
12 // Ask the user to manage permitted media galleries. | 12 // Ask the user to manage permitted media galleries. |
13 yes, | 13 yes, |
14 // Ask the user to manage permitted galleries only if the return set would | 14 // Ask the user to manage permitted galleries only if the return set would |
15 // otherwise be empty. | 15 // otherwise be empty. |
16 if_needed | 16 if_needed |
17 }; | 17 }; |
18 | 18 |
19 [inline_doc] dictionary MediaFileSystemsDetails { | 19 [inline_doc] dictionary MediaFileSystemsDetails { |
| 20 // [Deprecated] use manageMediaLocations and ManageRequestDetails instead. |
| 21 // |
20 // Whether to prompt the user for permission to additional media galleries | 22 // Whether to prompt the user for permission to additional media galleries |
21 // before returning the permitted set. Default is silent. If the value | 23 // before returning the permitted set. Default is silent. If the value |
22 // 'yes' is passed, or if the application has not been granted access to | 24 // 'yes' is passed, or if the application has not been granted access to |
23 // any media galleries and the value 'if_needed' is passed, then the | 25 // any media galleries and the value 'if_needed' is passed, then the |
24 // media gallery configuration dialog will be displayed. | 26 // media gallery configuration dialog will be displayed. |
25 GetMediaFileSystemsInteractivity? interactive; | 27 GetMediaFileSystemsInteractivity? interactive; |
26 }; | 28 }; |
27 | 29 |
28 callback MediaFileSystemsCallback = | 30 callback MediaFileSystemsCallback = |
29 void ([instanceOf=DOMFileSystem] optional object[] mediaFileSystems); | 31 void ([instanceOf=DOMFileSystem] object[] mediaFileSystems); |
| 32 |
| 33 [inline_doc] enum ManageRequestType { |
| 34 // Ask the user to manage permitted media galleries. |
| 35 manage, |
| 36 |
| 37 // Present a directory picker to the user and add access to the directory |
| 38 // the user selects. |
| 39 directory_prompt |
| 40 }; |
| 41 |
| 42 [inline_doc] dictionary ManageRequestDetails { |
| 43 // Specify the management action to take. |
| 44 ManageRequestType type; |
| 45 }; |
| 46 |
| 47 [inline_doc] dictionary ManageRequestResults { |
| 48 // The returned file systems. Null on failure. |
| 49 // For the "manage" request, the returned array contains the user-permitted |
| 50 // galleries. The array may be empty. |
| 51 // For the "directory_prompt" request, the returned array contains the |
| 52 // user-selected gallery. If the user cancels, the returned array is empty. |
| 53 [instanceOf=DOMFileSystem] object[] media_file_systems; |
| 54 }; |
| 55 |
| 56 callback ManageMediaLocationsCallback = void (ManageRequestResults results); |
30 | 57 |
31 [inline_doc] dictionary MediaFileSystemMetadata { | 58 [inline_doc] dictionary MediaFileSystemMetadata { |
32 // The name of the file system. | 59 // The name of the file system. |
33 DOMString name; | 60 DOMString name; |
34 | 61 |
35 // A unique and persistent id for the media gallery. | 62 // A unique and persistent id for the media gallery. |
36 DOMString galleryId; | 63 DOMString galleryId; |
37 | 64 |
38 // If the media gallery is on a removable device, a unique id for the | 65 // If the media gallery is on a removable device, a unique id for the |
39 // device while the device is online. | 66 // device while the device is online. |
(...skipping 12 matching lines...) Expand all Loading... |
52 | 79 |
53 callback MediaGalleriesMetadataCallback = | 80 callback MediaGalleriesMetadataCallback = |
54 void (MediaFileSystemMetadata[] metadata); | 81 void (MediaFileSystemMetadata[] metadata); |
55 | 82 |
56 interface Functions { | 83 interface Functions { |
57 // Get the media galleries configured in this user agent. If none are | 84 // Get the media galleries configured in this user agent. If none are |
58 // configured or available, the callback will receive an empty array. | 85 // configured or available, the callback will receive an empty array. |
59 static void getMediaFileSystems(optional MediaFileSystemsDetails details, | 86 static void getMediaFileSystems(optional MediaFileSystemsDetails details, |
60 MediaFileSystemsCallback callback); | 87 MediaFileSystemsCallback callback); |
61 | 88 |
| 89 // Manage existing media location or request access to new media locations. |
| 90 // In all cases the user will be prompted. The callback will be called |
| 91 // when the user is done and will include all media galleries. |
| 92 static void manageMediaLocations(ManageRequestDetails details, |
| 93 ManageMediaLocationsCallback callback); |
| 94 |
62 // Get metadata about a specific media file system. | 95 // Get metadata about a specific media file system. |
63 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( | 96 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( |
64 [instanceOf=DOMFileSystem] object mediaFileSystem); | 97 [instanceOf=DOMFileSystem] object mediaFileSystem); |
65 | 98 |
66 // Get metadata for all available media galleries. | 99 // Get metadata for all available media galleries. |
67 static void getAllMediaFileSystemMetadata( | 100 static void getAllMediaFileSystemMetadata( |
68 MediaGalleriesMetadataCallback callback); | 101 MediaGalleriesMetadataCallback callback); |
69 }; | 102 }; |
70 | 103 |
71 }; | 104 }; |
OLD | NEW |