OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.experimental.systemInfo.storage</code> API to query | 5 // Use the <code>chrome.experimental.systemInfo.storage</code> API to query |
6 // storage device information and be notified when it changes. | 6 // storage device information and be notified when it changes. |
7 namespace experimental.systemInfo.storage { | 7 namespace experimental.systemInfo.storage { |
8 | 8 |
9 enum StorageUnitType { | 9 enum StorageUnitType { |
Hongbo Min
2013/07/08 06:52:43
nit: Now we can remove StorageUnitType definition.
Haojian Wu
2013/07/08 07:46:30
Done.
| |
10 // The storage has fixed media, e.g. hard disk or SSD. | 10 // The storage has fixed media, e.g. hard disk or SSD. |
11 fixed, | 11 fixed, |
12 // The storage is removable, e.g. USB flash drive. | 12 // The storage is removable, e.g. USB flash drive. |
13 removable, | 13 removable, |
14 // The storage type is unknown. | 14 // The storage type is unknown. |
15 unknown | 15 unknown |
16 }; | 16 }; |
17 | 17 |
18 dictionary StorageUnitInfo { | |
19 // The unique storage id. It will use the transient ID. | |
20 DOMString id; | |
21 // The name of the storage unit. | |
22 DOMString name; | |
23 // The media type of the storage unit. | |
24 StorageUnitType type; | |
25 // The total amount of the storage space, in bytes. | |
26 // Default value is 0 if query operation fails. | |
27 double capacity; | |
28 // The available amount of the storage space, in bytes. | |
29 // Default value is 0 if query operation fails. | |
30 double availableCapacity; | |
31 }; | |
32 | |
33 dictionary StorageFreeSpaceChangeInfo { | 18 dictionary StorageFreeSpaceChangeInfo { |
34 // The transient id of the storage unit already changed. | 19 // The transient id of the storage unit already changed. |
35 DOMString id; | 20 DOMString id; |
36 // The new value of the available capacity. | 21 // The new value of the available capacity. |
37 double availableCapacity; | 22 double availableCapacity; |
38 }; | 23 }; |
39 | 24 |
40 // A dictionary that describes the add particular storage device watch | 25 // A dictionary that describes the add particular storage device watch |
41 // request results. | 26 // request results. |
42 dictionary AddWatchResult { | 27 dictionary AddWatchResult { |
43 DOMString id; | 28 DOMString id; |
44 boolean success; | 29 boolean success; |
45 }; | 30 }; |
46 | 31 |
47 callback StorageInfoCallback = void (StorageUnitInfo[] info); | |
48 | |
49 callback AddWatchCallback = void (AddWatchResult info); | 32 callback AddWatchCallback = void (AddWatchResult info); |
50 | 33 |
51 callback GetAllWatchCallback = void (DOMString[] storageIds); | 34 callback GetAllWatchCallback = void (DOMString[] storageIds); |
52 | 35 |
53 interface Functions { | 36 interface Functions { |
54 // Get the storage information from the system. The argument passed to the | |
55 // callback is an array of StorageUnitInfo objects. | |
56 static void get(StorageInfoCallback callback); | |
57 | |
58 // Monitor a particular storage device available change capacity. | 37 // Monitor a particular storage device available change capacity. |
59 static void addWatch(DOMString id, AddWatchCallback callback); | 38 static void addWatch(DOMString id, AddWatchCallback callback); |
60 | 39 |
61 // Remove the monitor of a particular device. | 40 // Remove the monitor of a particular device. |
62 static void removeWatch(DOMString id); | 41 static void removeWatch(DOMString id); |
63 | 42 |
64 // Get all the watched storage devices. | 43 // Get all the watched storage devices. |
65 static void getAllWatch(GetAllWatchCallback callback); | 44 static void getAllWatch(GetAllWatchCallback callback); |
66 | 45 |
67 // Remove all the storage devices monitors. | 46 // Remove all the storage devices monitors. |
68 static void removeAllWatch(); | 47 static void removeAllWatch(); |
69 }; | 48 }; |
70 | 49 |
71 interface Events { | 50 interface Events { |
72 // Fired when the storage device available capacity is changed. | 51 // Fired when the storage device available capacity is changed. |
73 // |info|: The changed information for the specified storage unit. | 52 // |info|: The changed information for the specified storage unit. |
74 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info); | 53 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info); |
Hongbo Min
2013/07/08 06:52:43
Maybe here we need to add 'getAvailableCapacity' f
Haojian Wu
2013/07/08 07:46:30
Yes. My plan is to implement the 'getAvailableCapa
| |
75 | |
76 // Fired when a new removable storage is attached to the system. | |
77 static void onAttached(StorageUnitInfo info); | |
78 | |
79 // Fired when a removable storage is detached from the system. | |
80 static void onDetached(DOMString id); | |
81 }; | 54 }; |
82 | |
83 }; | 55 }; |
84 | 56 |
OLD | NEW |