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 // This is a private API since M23. This will be superceded by the
      6 // systeminfo.storage API in the future.
      7 // See http://crbug.com/166950 and http://crbug.com/177605.
      8 namespace mediaGalleriesPrivate {
      9   // A dictionary that describes an attached device.
     10   [inline_doc] dictionary DeviceAttachmentDetails {
     11     // The name of the device.
     12     DOMString deviceName;
     13 
     14     // A transient id that unique identifies the device.
     15     DOMString deviceId;
     16   };
     17 
     18   // A dictionary that describes a detached device.
     19   [inline_doc] dictionary DeviceDetachmentDetails {
     20     // A transient id that unique identifies the device.
     21     DOMString deviceId;
     22   };
     23 
     24   // A dictionary that describes the modified gallery.
     25   [inline_doc] dictionary GalleryChangeDetails {
     26     // Gallery identifier.
     27     DOMString galleryId;
     28   };
     29 
     30   interface Events {
     31     // Fired when a media device gets attached.
     32     static void onDeviceAttached(DeviceAttachmentDetails details);
     33 
     34     // Fired when a media device gets detached.
     35     static void onDeviceDetached(DeviceDetachmentDetails details);
     36 
     37     // Fired when a media gallery is changed.
     38     static void onGalleryChanged(GalleryChangeDetails details);
     39   };
     40 
     41   // A dictionary that describes the add gallery watch request results.
     42   dictionary AddGalleryWatchResult {
     43     DOMString galleryId;
     44     boolean success;
     45   };
     46 
     47   callback AddGalleryWatchCallback = void (AddGalleryWatchResult result);
     48   callback GetAllGalleryWatchCallback = void (DOMString[] galleryIds);
     49 
     50   // These enum bits have moved to experimental.systemInfo.storage namespace.
     51   // See experimental_system_info_storage.idl.
     52   [inline_doc] enum EjectDeviceResultCode {
     53     // The ejection command is successful -- the application can prompt the user
     54     // to remove the device.
     55     success,
     56     // The device is in use by another application. The ejection did not
     57     // succeed; the user should not remove the device until the other
     58     // application is done with the device.
     59     in_use,
     60     // There is no such device known.
     61     no_such_device,
     62     // The ejection command failed.
     63     failure
     64   };
     65 
     66   callback EjectDeviceCallback = void (EjectDeviceResultCode result);
     67 
     68   // A dictionary that describes a media galleries handler.
     69   [inline_doc] dictionary MediaGalleriesHandler {
     70     // Unique action id per extension.
     71     DOMString id;
     72 
     73     // ID of the extension handling this handler.
     74     DOMString extensionId;
     75 
     76     // Localized title describing the action.
     77     DOMString title;
     78 
     79     // Url of the icon.
     80     DOMString iconUrl;
     81   };
     82 
     83   callback GetHandlersCallback = void (MediaGalleriesHandler[] handlers);
     84 
     85   interface Functions {
     86     static void addGalleryWatch(DOMString galleryId,
     87                                 AddGalleryWatchCallback callback);
     88     static void removeGalleryWatch(DOMString galleryId);
     89     static void getAllGalleryWatch(GetAllGalleryWatchCallback callback);
     90     static void removeAllGalleryWatch();
     91     // The function has moved to system.storage namespace.
     92     // See system_storage.idl.
     93     static void ejectDevice(DOMString deviceId, EjectDeviceCallback callback);
     94     static void getHandlers(GetHandlersCallback callback);
     95   };
     96 };
     97