Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 [inline_doc] enum GetMetadataType { | 27 [inline_doc] enum GetMetadataType { |
| 28 // Retrieve the mime type, metadata tags, and attached images. | 28 // Retrieve the mime type, metadata tags, and attached images. |
| 29 all, | 29 all, |
| 30 // Retrieve only the mime type and the metadata tags. | 30 // Retrieve only the mime type and the metadata tags. |
| 31 mimeTypeAndTags, | 31 mimeTypeAndTags, |
| 32 // Retrieve only the mime type. | 32 // Retrieve only the mime type. |
| 33 mimeTypeOnly | 33 mimeTypeOnly |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 [inline_doc] enum ScanProgressType { | 36 [nodefine, inline_doc] enum ScanProgressType { |
|
Devlin
2016/02/29 20:37:24
Have you checked locally that this does the right
tommycli
2016/02/29 21:53:30
Yes, I have checked manually via server2/preview.p
Devlin
2016/02/29 22:10:44
I don't think we ever had beta/dev/trunk docs. We
tommycli
2016/02/29 22:49:03
Yes, reading the code that looks correct.
| |
| 37 // The scan started. | 37 // The scan started. |
| 38 start, | 38 start, |
| 39 // The scan was cancelled. | 39 // The scan was cancelled. |
| 40 cancel, | 40 cancel, |
| 41 // The scan finished but none of the result have been added, | 41 // The scan finished but none of the result have been added, |
| 42 // addScanResults() has to be called to ask the user for permission. | 42 // addScanResults() has to be called to ask the user for permission. |
| 43 finish, | 43 finish, |
| 44 // The scan encountered an error and could not proceed. | 44 // The scan encountered an error and could not proceed. |
| 45 error | 45 error |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 [inline_doc] dictionary GalleryChangeDetails { | 48 [inline_doc] dictionary GalleryChangeDetails { |
| 49 // Type of change event. | 49 // Type of change event. |
| 50 GalleryChangeType type; | 50 GalleryChangeType type; |
| 51 | 51 |
| 52 // Identifies the modified gallery. | 52 // Identifies the modified gallery. |
| 53 DOMString galleryId; | 53 DOMString galleryId; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 [inline_doc] dictionary MediaFileSystemsDetails { | 56 [inline_doc] dictionary MediaFileSystemsDetails { |
| 57 // Whether to prompt the user for permission to additional media galleries | 57 // Whether to prompt the user for permission to additional media galleries |
| 58 // before returning the permitted set. Default is silent. If the value | 58 // before returning the permitted set. Default is silent. If the value |
| 59 // 'yes' is passed, or if the application has not been granted access to | 59 // 'yes' is passed, or if the application has not been granted access to |
| 60 // any media galleries and the value 'if_needed' is passed, then the | 60 // any media galleries and the value 'if_needed' is passed, then the |
| 61 // media gallery configuration dialog will be displayed. | 61 // media gallery configuration dialog will be displayed. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 92 boolean isRemovable; | 92 boolean isRemovable; |
| 93 | 93 |
| 94 // True if the device the media gallery is on was detected as a media | 94 // True if the device the media gallery is on was detected as a media |
| 95 // device. i.e. a PTP or MTP device, or a DCIM directory is present. | 95 // device. i.e. a PTP or MTP device, or a DCIM directory is present. |
| 96 boolean isMediaDevice; | 96 boolean isMediaDevice; |
| 97 | 97 |
| 98 // True if the device is currently available. | 98 // True if the device is currently available. |
| 99 boolean isAvailable; | 99 boolean isAvailable; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 [inline_doc] dictionary ScanProgressDetails { | 102 [nodefine, inline_doc] dictionary ScanProgressDetails { |
| 103 // The type of progress event, i.e. start, finish, etc. | 103 // The type of progress event, i.e. start, finish, etc. |
| 104 ScanProgressType type; | 104 ScanProgressType type; |
| 105 | 105 |
| 106 // The number of Galleries found. | 106 // The number of Galleries found. |
| 107 long? galleryCount; | 107 long? galleryCount; |
| 108 | 108 |
| 109 // Appoximate number of media files found; some file types can be either | 109 // Appoximate number of media files found; some file types can be either |
| 110 // audio or video and are included in both counts. | 110 // audio or video and are included in both counts. |
| 111 long? audioCount; | 111 long? audioCount; |
| 112 long? imageCount; | 112 long? imageCount; |
| 113 long? videoCount; | 113 long? videoCount; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 callback MediaFileSystemsMetadataCallback = | 116 callback MediaFileSystemsMetadataCallback = |
| 117 void (MediaFileSystemMetadata[] metadata); | 117 void (MediaFileSystemMetadata[] metadata); |
| 118 | 118 |
| 119 dictionary StreamInfo { | 119 dictionary StreamInfo { |
| 120 // Describes format of container or codec of stream, i.e. "mp3", "h264". | 120 // Describes format of container or codec of stream, i.e. "mp3", "h264". |
| 121 DOMString type; | 121 DOMString type; |
| 122 | 122 |
| 123 // An unfiltered string->string dictionary of tags for the stream. | 123 // An unfiltered string->string dictionary of tags for the stream. |
| 124 object tags; | 124 object tags; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 dictionary MediaMetadata { | 127 dictionary MediaMetadata { |
| 128 // The browser sniffed mime type. | 128 // The browser sniffed mime type. |
| 129 DOMString mimeType; | 129 DOMString mimeType; |
| 130 | 130 |
| 131 // Defined for images and video. In pixels. | 131 // Defined for images and video. In pixels. |
| 132 long? height; | 132 long? height; |
| 133 long? width; | 133 long? width; |
| 134 | 134 |
| 135 // Defined for images only. | 135 // Defined for images only. |
| 136 double? xResolution; | 136 double? xResolution; |
| 137 double? yResolution; | 137 double? yResolution; |
| 138 | 138 |
| 139 // Defined for audio and video. In seconds. | 139 // Defined for audio and video. In seconds. |
| 140 double? duration; | 140 double? duration; |
| 141 | 141 |
| 142 // Defined for images and video. In degrees. | 142 // Defined for images and video. In degrees. |
| 143 long? rotation; | 143 long? rotation; |
| 144 | 144 |
| 145 // Defined for images only. | 145 // Defined for images only. |
| 146 DOMString? cameraMake; | 146 DOMString? cameraMake; |
| 147 DOMString? cameraModel; | 147 DOMString? cameraModel; |
| 148 double? exposureTimeSeconds; | 148 double? exposureTimeSeconds; |
| 149 boolean? flashFired; | 149 boolean? flashFired; |
| 150 double? fNumber; | 150 double? fNumber; |
| 151 double? focalLengthMm; | 151 double? focalLengthMm; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 197 |
| 198 // Give up access to a given media gallery. | 198 // Give up access to a given media gallery. |
| 199 static void dropPermissionForMediaFileSystem( | 199 static void dropPermissionForMediaFileSystem( |
| 200 DOMString galleryId, | 200 DOMString galleryId, |
| 201 optional DropPermissionForMediaFileSystemCallback callback); | 201 optional DropPermissionForMediaFileSystemCallback callback); |
| 202 | 202 |
| 203 // Start a scan of the user's hard disks for directories containing media. | 203 // Start a scan of the user's hard disks for directories containing media. |
| 204 // The scan may take a long time so progress and completion is communicated | 204 // The scan may take a long time so progress and completion is communicated |
| 205 // by events. No permission is granted as a result of the scan, see | 205 // by events. No permission is granted as a result of the scan, see |
| 206 // addScanResults. | 206 // addScanResults. |
| 207 [nodefine, deprecated="The mediaGalleries API no longer supports scanning."] | |
| 207 static void startMediaScan(); | 208 static void startMediaScan(); |
| 208 | 209 |
| 209 // Cancel any pending media scan. Well behaved apps should provide a way | 210 // Cancel any pending media scan. Well behaved apps should provide a way |
| 210 // for the user to cancel scans they start. | 211 // for the user to cancel scans they start. |
| 212 [nodefine, deprecated="The mediaGalleries API no longer supports scanning."] | |
| 211 static void cancelMediaScan(); | 213 static void cancelMediaScan(); |
| 212 | 214 |
| 213 // Show the user the scan results and let them add any or all of them as | 215 // Show the user the scan results and let them add any or all of them as |
| 214 // galleries. This should be used after the 'finish' onScanProgress() | 216 // galleries. This should be used after the 'finish' onScanProgress() |
| 215 // event has happened. All galleries the app has access to are returned, not | 217 // event has happened. All galleries the app has access to are returned, not |
| 216 // just the newly added galleries. | 218 // just the newly added galleries. |
| 219 [nodefine, deprecated="The mediaGalleries API no longer supports scanning."] | |
| 217 static void addScanResults(MediaFileSystemsCallback callback); | 220 static void addScanResults(MediaFileSystemsCallback callback); |
| 218 | 221 |
| 219 // Get metadata about a specific media file system. | 222 // Get metadata about a specific media file system. |
| 220 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( | 223 [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata( |
| 221 [instanceOf=DOMFileSystem] object mediaFileSystem); | 224 [instanceOf=DOMFileSystem] object mediaFileSystem); |
| 222 | 225 |
| 223 // Get metadata for all available media galleries. | 226 // Get metadata for all available media galleries. |
| 224 static void getAllMediaFileSystemMetadata( | 227 static void getAllMediaFileSystemMetadata( |
| 225 MediaFileSystemsMetadataCallback callback); | 228 MediaFileSystemsMetadataCallback callback); |
| 226 | 229 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 244 // Removes all gallery watches. | 247 // Removes all gallery watches. |
| 245 static void removeAllGalleryWatch(); | 248 static void removeAllGalleryWatch(); |
| 246 }; | 249 }; |
| 247 | 250 |
| 248 interface Events { | 251 interface Events { |
| 249 // Fired when a media gallery is changed or a gallery watch is dropped. | 252 // Fired when a media gallery is changed or a gallery watch is dropped. |
| 250 static void onGalleryChanged(GalleryChangeDetails details); | 253 static void onGalleryChanged(GalleryChangeDetails details); |
| 251 | 254 |
| 252 // The pending media scan has changed state. See details for more | 255 // The pending media scan has changed state. See details for more |
| 253 // information. | 256 // information. |
| 257 [nodefine, deprecated="The mediaGalleries API no longer supports scanning."] | |
| 254 static void onScanProgress(ScanProgressDetails details); | 258 static void onScanProgress(ScanProgressDetails details); |
| 255 }; | 259 }; |
| 256 }; | 260 }; |
| OLD | NEW |