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 namespace experimental.systemInfo.storage { | 5 namespace experimental.systemInfo.storage { |
6 | 6 |
7 enum StorageUnitType { | 7 enum StorageUnitType { |
8 // The storage has fixed media, e.g. hard disk or SSD. | 8 // The storage has fixed media, e.g. hard disk or SSD. |
9 fixed, | 9 fixed, |
10 // The storage is removable, e.g. USB flash drive. | 10 // The storage is removable, e.g. USB flash drive. |
(...skipping 13 matching lines...) Expand all Loading... |
24 double availableCapacity; | 24 double availableCapacity; |
25 }; | 25 }; |
26 | 26 |
27 dictionary StorageChangeInfo { | 27 dictionary StorageChangeInfo { |
28 // The uniue id of the storage unit already changed. | 28 // The uniue id of the storage unit already changed. |
29 DOMString id; | 29 DOMString id; |
30 // The new value of the available capacity. | 30 // The new value of the available capacity. |
31 double availableCapacity; | 31 double availableCapacity; |
32 }; | 32 }; |
33 | 33 |
| 34 // A dictionary that describes the add particular storage device watch |
| 35 // request results. |
| 36 dictionary AddWatchResult { |
| 37 DOMString id; |
| 38 boolean success; |
| 39 }; |
| 40 |
34 callback StorageInfoCallback = void (StorageUnitInfo[] info); | 41 callback StorageInfoCallback = void (StorageUnitInfo[] info); |
35 | 42 |
| 43 callback AddWatchCallback = void (AddWatchResult info); |
| 44 |
| 45 callback GetAllWatchCallback = void (DOMString[] storageIds); |
| 46 |
36 interface Functions { | 47 interface Functions { |
37 // Get the storage information from the system. The argument passed to the | 48 // Get the storage information from the system. The argument passed to the |
38 // callback is an array of StorageUnitInfo objects. | 49 // callback is an array of StorageUnitInfo objects. |
39 static void get(StorageInfoCallback callback); | 50 static void get(StorageInfoCallback callback); |
| 51 |
| 52 // Monitor a particular storage device available change capacity. |
| 53 static void addWatch(DOMString id, AddWatchCallback callback); |
| 54 |
| 55 // Remove the monitor of a particular device. |
| 56 static void removeWatch(DOMString id); |
| 57 |
| 58 // Get all the watched storage devices. |
| 59 static void getAllWatch(GetAllWatchCallback callback); |
| 60 |
| 61 // Remove all the storage devices monitors. |
| 62 static void removeAllWatch(); |
40 }; | 63 }; |
41 | 64 |
42 interface Events { | 65 interface Events { |
43 // Fired when the storage device available capacity is changed. | 66 // Fired when the storage device available capacity is changed. |
44 // |info|: The changed information for the specified storage unit. | 67 // |info|: The changed information for the specified storage unit. |
45 static void onAvailableCapacityChanged(StorageChangeInfo info); | 68 static void onAvailableCapacityChanged(StorageChangeInfo info); |
46 | 69 |
47 // Fired when a new removable storage is attached to the system. | 70 // Fired when a new removable storage is attached to the system. |
48 static void onAttached(StorageUnitInfo info); | 71 static void onAttached(StorageUnitInfo info); |
49 | 72 |
50 // Fired when a removable storage is detached from the system. | 73 // Fired when a removable storage is detached from the system. |
51 static void onDetached(DOMString id); | 74 static void onDetached(DOMString id); |
52 }; | 75 }; |
53 | 76 |
54 }; | 77 }; |
55 | 78 |
OLD | NEW |