summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/media_galleries.idl
blob: f1a92a4894b6ee2dd11563ee7e82a5e5a165f802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

namespace mediaGalleries {

  [inline_doc] enum GetMediaFileSystemsInteractivity {
    // Do not act interactively.
    no,
    // Ask the user to manage permitted media galleries.
    yes,
    // Ask the user to manage permitted galleries only if the return set would
    // otherwise be empty.
    if_needed
  };

  [inline_doc] dictionary MediaFileSystemsDetails {
    // Whether to prompt the user for permission to additional media galleries
    // before returning the permitted set. Default is silent.  If the value
    // 'yes' is passed, or if the application has not been granted access to
    // any media galleries and the value 'if_needed' is passed, then the
    // media gallery configuration dialog will be displayed.
    GetMediaFileSystemsInteractivity? interactive;
  };

  callback MediaFileSystemsCallback =
      void ([instanceOf=DOMFileSystem] optional object[] mediaFileSystems);

  [inline_doc] dictionary MediaFileSystemMetadata {
    // The name of the file system.
    DOMString name;

    // A unique and persistent id for the media gallery.
    DOMString galleryId;

    // If the media gallery is on a removable device, a unique id for the
    // device.
    DOMString? deviceId;

    // True if the media gallery is on a removable device.
    boolean isRemovable;

    // True if the device the media gallery is on was detected as a media
    // device.  i.e. a PTP or MTP device, or a DCIM directory is present.
    boolean isMediaDevice;
  };

  interface Functions {
    // Get the media galleries configured in this user agent. If none are
    // configured or available, the callback will receive an empty array.
    static void getMediaFileSystems(optional MediaFileSystemsDetails details,
                                    MediaFileSystemsCallback callback);

    // Get metadata about a specific media file system.
    [nocompile] static MediaFileSystemMetadata getMediaFileSystemMetadata(
        [instanceOf=DOMFileSystem] object mediaFileSystem);
  };

};