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 { | |
vandebo (ex-Chrome)
2013/12/02 18:01:30
This is inconsistent with MediaFileSystemsCallback
Lei Zhang
2013/12/03 03:33:23
Flexibility. You can add new key/value pairs in th
| |
48 // The returned file systems. Null on failure. | |
49 [instanceOf=DOMFileSystem] object[] media_file_systems; | |
50 }; | |
51 | |
52 callback ManageMediaLocationsCallback = void (ManageRequestResults results); | |
vandebo (ex-Chrome)
2013/12/02 18:01:30
It doesn't seem like there is a way to know if a '
Lei Zhang
2013/12/03 03:33:23
|media_file_systems| has multiple states. As menti
vandebo (ex-Chrome)
2013/12/03 21:08:02
I don't like this interface because it introduces
Lei Zhang
2013/12/05 05:52:15
Done. I did what I said I would do from yesterday'
| |
30 | 53 |
31 [inline_doc] dictionary MediaFileSystemMetadata { | 54 [inline_doc] dictionary MediaFileSystemMetadata { |
32 // The name of the file system. | 55 // The name of the file system. |
33 DOMString name; | 56 DOMString name; |
34 | 57 |
35 // A unique and persistent id for the media gallery. | 58 // A unique and persistent id for the media gallery. |
36 DOMString galleryId; | 59 DOMString galleryId; |
37 | 60 |
38 // If the media gallery is on a removable device, a unique id for the | 61 // If the media gallery is on a removable device, a unique id for the |
39 // device while the device is online. | 62 // device while the device is online. |
(...skipping 12 matching lines...) Expand all Loading... | |
52 | 75 |
53 callback MediaGalleriesMetadataCallback = | 76 callback MediaGalleriesMetadataCallback = |
54 void (MediaFileSystemMetadata[] metadata); | 77 void (MediaFileSystemMetadata[] metadata); |
55 | 78 |
56 interface Functions { | 79 interface Functions { |
57 // Get the media galleries configured in this user agent. If none are | 80 // Get the media galleries configured in this user agent. If none are |
58 // configured or available, the callback will receive an empty array. | 81 // configured or available, the callback will receive an empty array. |
59 static void getMediaFileSystems(optional MediaFileSystemsDetails details, | 82 static void getMediaFileSystems(optional MediaFileSystemsDetails details, |
60 MediaFileSystemsCallback callback); | 83 MediaFileSystemsCallback callback); |
61 | 84 |
85 // Manage existing media location or request access to new media locations. | |
86 // In all cases the user will be prompted. The callback will be called | |
87 // when the user is done and will include all media galleries. | |
88 static void manageMediaLocations(ManageRequestDetails details, | |
89 ManageMediaLocationsCallback callback); | |
90 | |
62 // Get metadata about a specific media file system. | 91 // Get metadata about a specific media file system. |
63 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( | 92 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( |
64 [instanceOf=DOMFileSystem] object mediaFileSystem); | 93 [instanceOf=DOMFileSystem] object mediaFileSystem); |
65 | 94 |
66 // Get metadata for all available media galleries. | 95 // Get metadata for all available media galleries. |
67 static void getAllMediaFileSystemMetadata( | 96 static void getAllMediaFileSystemMetadata( |
68 MediaGalleriesMetadataCallback callback); | 97 MediaGalleriesMetadataCallback callback); |
69 }; | 98 }; |
70 | 99 |
71 }; | 100 }; |
OLD | NEW |