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 array contains the user-permitted galleries. | |
49 // The array may be empty if no accessible galleries exist. The value can | |
50 // also be null on failure. | |
51 [instanceOf=DOMFileSystem] object[] mediaFileSystems; | |
52 | |
53 // For "directory_prompt" requests, the file system name for the user | |
54 // selected gallery. Empty if the user cancels or in case of failure. | |
55 DOMString userSelectedFilesSystemName; | |
vandebo (ex-Chrome)
2013/12/18 20:15:53
Should this be marked optional? i.e. for non direc
| |
56 }; | |
57 | |
58 callback ManageMediaLocationsCallback = void (ManageRequestResults results); | |
30 | 59 |
31 [inline_doc] dictionary MediaFileSystemMetadata { | 60 [inline_doc] dictionary MediaFileSystemMetadata { |
32 // The name of the file system. | 61 // The name of the file system. |
33 DOMString name; | 62 DOMString name; |
34 | 63 |
35 // A unique and persistent id for the media gallery. | 64 // A unique and persistent id for the media gallery. |
36 DOMString galleryId; | 65 DOMString galleryId; |
37 | 66 |
38 // If the media gallery is on a removable device, a unique id for the | 67 // If the media gallery is on a removable device, a unique id for the |
39 // device while the device is online. | 68 // device while the device is online. |
(...skipping 17 matching lines...) Expand all Loading... | |
57 // The browser sniffed mime type. | 86 // The browser sniffed mime type. |
58 DOMString mimeType; | 87 DOMString mimeType; |
59 }; | 88 }; |
60 | 89 |
61 interface Functions { | 90 interface Functions { |
62 // Get the media galleries configured in this user agent. If none are | 91 // Get the media galleries configured in this user agent. If none are |
63 // configured or available, the callback will receive an empty array. | 92 // configured or available, the callback will receive an empty array. |
64 static void getMediaFileSystems(optional MediaFileSystemsDetails details, | 93 static void getMediaFileSystems(optional MediaFileSystemsDetails details, |
65 MediaFileSystemsCallback callback); | 94 MediaFileSystemsCallback callback); |
66 | 95 |
96 // Manage existing media location or request access to new media locations. | |
97 // In all cases the user will be prompted. The callback will be called | |
98 // when the user is done and will include all media galleries. | |
99 static void manageMediaLocations(ManageRequestDetails details, | |
100 ManageMediaLocationsCallback callback); | |
101 | |
67 // Get metadata about a specific media file system. | 102 // Get metadata about a specific media file system. |
68 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( | 103 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( |
69 [instanceOf=DOMFileSystem] object mediaFileSystem); | 104 [instanceOf=DOMFileSystem] object mediaFileSystem); |
70 | 105 |
71 // Get metadata for all available media galleries. | 106 // Get metadata for all available media galleries. |
72 static void getAllMediaFileSystemMetadata( | 107 static void getAllMediaFileSystemMetadata( |
73 MediaFileSystemsMetadataCallback callback); | 108 MediaFileSystemsMetadataCallback callback); |
74 }; | 109 }; |
75 | 110 |
76 }; | 111 }; |
OLD | NEW |