| 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 // Unknow storage type. | 8 // Unknow storage type. |
| 9 unknown, | 9 unknown, |
| 10 // Hard disk. | 10 // Hard disk. |
| 11 harddisk, | 11 harddisk, |
| 12 // Removable storage, e.g.USB device. | 12 // Removable storage, e.g.USB device. |
| 13 removable | 13 removable |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 dictionary StorageUnitInfo { | 16 dictionary StorageUnitInfo { |
| 17 // The unique id of the storage unit. | 17 // The unique id of the storage unit. |
| 18 DOMString id; | 18 DOMString id; |
| 19 // The type of storage device. The value is one of the constants defined | 19 // The type of storage device. The value is one of the constants defined |
| 20 // for this type. | 20 // for this type. |
| 21 StorageUnitType type; | 21 StorageUnitType type; |
| 22 // The total amount of the storage space, in bytes. | 22 // The total amount of the storage space, in bytes. |
| 23 double capacity; | 23 double capacity; |
| 24 // The available amount of the storage space, in bytes. | 24 // The available amount of the storage space, in bytes. |
| 25 double availableCapacity; | 25 double availableCapacity; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 dictionary StorageUnitChangeInfo { |
| 29 // The uniue id of the storage unit already changed. |
| 30 DOMString id; |
| 31 // The new value of the available capacity. |
| 32 double availableCapacity; |
| 33 }; |
| 34 |
| 28 dictionary StorageInfo { | 35 dictionary StorageInfo { |
| 29 // The array of storage units connected to the system. | 36 // The array of storage units connected to the system. |
| 30 StorageUnitInfo[] units; | 37 StorageUnitInfo[] units; |
| 31 }; | 38 }; |
| 32 | 39 |
| 33 callback StorageInfoCallback = void (StorageInfo info); | 40 callback StorageInfoCallback = void (StorageInfo info); |
| 34 | 41 |
| 35 interface Functions { | 42 interface Functions { |
| 36 // Get the storage information from the system. | 43 // Get the storage information from the system. |
| 37 static void get(StorageInfoCallback callback); | 44 static void get(StorageInfoCallback callback); |
| 38 }; | 45 }; |
| 46 |
| 47 interface Events { |
| 48 // Fired when the storage information is updated. |
| 49 // |info| : The changed information for the specified storage unit |
| 50 static void onAvailableCapacityChanged(StorageUnitChangeInfo info); |
| 51 |
| 52 // Fired when a new storage unit is added to the system, |
| 53 // i.e. a new USB disk is plugged in. |
| 54 // |unit| : The information of the new storage unit |
| 55 static void onAdded(StorageUnitInfo unit); |
| 56 |
| 57 // Fired when a storage unit is removed from the system |
| 58 // i.e. a USB disk is unplugged |
| 59 // |id| : The unique ID of storage unit already removed |
| 60 static void onRemoved(DOMString id); |
| 61 }; |
| 62 |
| 39 }; | 63 }; |
| 40 | 64 |
| OLD | NEW |