File: system_storage.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (86 lines) | stat: -rw-r--r-- 2,873 bytes parent folder | download | duplicates (6)
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
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Use the <code>chrome.system.storage</code> API to query storage device
// information and be notified when a removable storage device is attached and
// detached.
namespace system.storage {

  enum StorageUnitType {
    // The storage has fixed media, e.g. hard disk or SSD.
    fixed,
    // The storage is removable, e.g. USB flash drive.
    removable,
    // The storage type is unknown.
    unknown
  };

  dictionary StorageUnitInfo {
    // The transient ID that uniquely identifies the storage device.
    // This ID will be persistent within the same run of a single application.
    // It will not be a persistent identifier between different runs of an
    // application, or between different applications.
    DOMString id;
    // The name of the storage unit.
    DOMString name;
    // The media type of the storage unit.
    StorageUnitType type;
    // The total amount of the storage space, in bytes.
    double capacity;
  };

  dictionary StorageAvailableCapacityInfo {
    // A copied |id| of getAvailableCapacity function parameter |id|.
    DOMString id;
    // The available capacity of the storage device, in bytes.
    double availableCapacity;
  };

  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);

  callback StorageInfoCallback = void (StorageUnitInfo[] info);

  callback GetAvailableCapacityCallback = void (
      StorageAvailableCapacityInfo info);

  interface Functions {
    // Get the storage information from the system. The argument passed to the
    // callback is an array of StorageUnitInfo objects.
    static void getInfo(StorageInfoCallback callback);

    // Ejects a removable storage device.
    static void ejectDevice(
        DOMString id,
        EjectDeviceCallback callback);

    // Get the available capacity of a specified |id| storage device.
    // The |id| is the transient device ID from StorageUnitInfo.
    static void getAvailableCapacity(
        DOMString id,
        GetAvailableCapacityCallback callback);
  };

  interface Events {
    // Fired when a new removable storage is attached to the system.
    static void onAttached(StorageUnitInfo info);

    // Fired when a removable storage is detached from the system.
    static void onDetached(DOMString id);
  };

};