summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/media_galleries_private.idl
blob: 9767e86e0cd6bec4cc862fc77471a268f2772966 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// 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.

// This is a private API for M23. This will be superceded by the
// systeminfo.storage API in M24.

namespace mediaGalleriesPrivate {
    // A dictionary that describes an attached device.
  [inline_doc] dictionary DeviceAttachmentDetails {
    // The name of the device.
    DOMString deviceName;

    // A transient id that unique identifies the device.
    DOMString deviceId;
  };

  // A dictionary that describes a detached device.
  [inline_doc] dictionary DeviceDetachmentDetails {
    // A transient id that unique identifies the device.
    DOMString deviceId;
  };

  // A dictionary that describes the modified gallery.
  [inline_doc] dictionary GalleryChangeDetails {
    // Gallery identifier.
    DOMString galleryId;
  };

  interface Events {
    // Fired when a media device gets attached.
    static void onDeviceAttached(DeviceAttachmentDetails details);

    // Fired when a media device gets detached.
    static void onDeviceDetached(DeviceDetachmentDetails details);

    // Fired when a media gallery is changed.
    static void onGalleryChanged(GalleryChangeDetails details);
  };

  // A dictionary that describes the add gallery watch request results.
  dictionary AddGalleryWatchResult {
    DOMString galleryId;
    boolean success;
  };

  callback AddGalleryWatchCallback = void (AddGalleryWatchResult result);
  callback GetAllGalleryWatchCallback = void (DOMString[] galleryIds);

  [inline_doc] enum EjectDeviceResultCode {
    // The ejection command is successful -- the application can prompt the user
    // to remove the device.
    success,
    // The device is in use by another application. The ejection did not
    // succeed; the user should not remove the device until the other
    // application is done with the device.
    in_use,
    // There is no such device known.
    no_such_device,
    // The ejection command failed.
    failure
  };

  callback EjectDeviceCallback = void (EjectDeviceResultCode result);

  interface Functions {
    static void addGalleryWatch(DOMString galleryId,
                                AddGalleryWatchCallback callback);
    static void removeGalleryWatch(DOMString galleryId);
    static void getAllGalleryWatch(GetAllGalleryWatchCallback callback);
    static void removeAllGalleryWatch();
    static void ejectDevice(DOMString deviceId, EjectDeviceCallback callback);
  };
};