Home | History | Annotate | Download | only in api
      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
      3 // found in the LICENSE file.
      4 
      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).
      7 namespace mediaGalleries {
      8 
      9   [inline_doc] enum GetMediaFileSystemsInteractivity {
     10     // Do not act interactively.
     11     no,
     12     // Ask the user to manage permitted media galleries.
     13     yes,
     14     // Ask the user to manage permitted galleries only if the return set would
     15     // otherwise be empty.
     16     if_needed
     17   };
     18 
     19   [inline_doc] dictionary MediaFileSystemsDetails {
     20     // Whether to prompt the user for permission to additional media galleries
     21     // 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
     23     // any media galleries and the value 'if_needed' is passed, then the
     24     // media gallery configuration dialog will be displayed.
     25     GetMediaFileSystemsInteractivity? interactive;
     26   };
     27 
     28   callback MediaFileSystemsCallback =
     29       void ([instanceOf=DOMFileSystem] optional object[] mediaFileSystems);
     30 
     31   [inline_doc] dictionary MediaFileSystemMetadata {
     32     // The name of the file system.
     33     DOMString name;
     34 
     35     // A unique and persistent id for the media gallery.
     36     DOMString galleryId;
     37 
     38     // If the media gallery is on a removable device, a unique id for the
     39     // device.
     40     DOMString? deviceId;
     41 
     42     // True if the media gallery is on a removable device.
     43     boolean isRemovable;
     44 
     45     // True if the device the media gallery is on was detected as a media
     46     // device.  i.e. a PTP or MTP device, or a DCIM directory is present.
     47     boolean isMediaDevice;
     48   };
     49 
     50   interface Functions {
     51     // Get the media galleries configured in this user agent. If none are
     52     // configured or available, the callback will receive an empty array.
     53     static void getMediaFileSystems(optional MediaFileSystemsDetails details,
     54                                     MediaFileSystemsCallback callback);
     55 
     56     // Get metadata about a specific media file system.
     57     [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata(
     58         [instanceOf=DOMFileSystem] object mediaFileSystem);
     59   };
     60 
     61 };
     62