Chromium Code Reviews| 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. |
| 11 removable, | 11 removable, |
| 12 // The storage type is unknown. | 12 // The storage type is unknown. |
| 13 unknown | 13 unknown |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 dictionary StorageUnitInfo { | 16 dictionary StorageUnitInfo { |
| 17 // The unique id of the storage unit. | 17 // The unique storage id. It is persistent between storage attachments. |
|
vandebo (ex-Chrome)
2013/05/28 20:00:29
This will take more work.
Hongbo Min
2013/05/29 01:05:38
Do you mean using transient ID instead?
| |
| 18 DOMString id; | 18 DOMString id; |
| 19 // The media type of the storage unit. | 19 // Human readable storage unit name. |
| 20 DOMString name; | |
| 21 // The mount path of the storage unit. | |
| 22 DOMString location; | |
| 23 // Human readable vendor name for the storage unit. May be empty if not | |
| 24 // collected. | |
| 25 DOMString vendorName; | |
| 26 // Human readable model name for the storage unit. May be empty if not | |
| 27 // collected. | |
| 28 DOMString modelName; | |
| 29 // The type of storage device. The value is one of the constants defined | |
| 30 // for this type. | |
| 20 StorageUnitType type; | 31 StorageUnitType type; |
| 21 // The total amount of the storage space, in bytes. | 32 // The total amount of the storage space, in bytes. |
| 22 double capacity; | 33 double capacity; |
| 23 // The available amount of the storage space, in bytes. | 34 // The available amount of the storage space, in bytes. |
| 24 double availableCapacity; | 35 double availableCapacity; |
| 25 }; | 36 }; |
| 26 | 37 |
| 27 dictionary StorageChangeInfo { | 38 dictionary StorageChangeInfo { |
| 28 // The uniue id of the storage unit already changed. | 39 // The uniue id of the storage unit already changed. |
| 29 DOMString id; | 40 DOMString id; |
| 41 // The old value of the available capacity. | |
| 42 double oldValue; | |
| 30 // The new value of the available capacity. | 43 // The new value of the available capacity. |
| 31 double availableCapacity; | 44 double newValue; |
| 32 }; | 45 }; |
| 33 | 46 |
| 34 callback StorageInfoCallback = void (StorageUnitInfo[] info); | 47 callback StorageInfoCallback = void (StorageUnitInfo[] info); |
| 35 | 48 |
| 36 interface Functions { | 49 interface Functions { |
| 37 // Get the storage information from the system. The argument passed to the | 50 // Get the storage information from the system. The argument passed to the |
| 38 // callback is an array of StorageUnitInfo objects. | 51 // callback is an array of StorageUnitInfo objects. |
| 39 static void get(StorageInfoCallback callback); | 52 static void get(StorageInfoCallback callback); |
| 40 }; | 53 }; |
| 41 | 54 |
| 42 interface Events { | 55 interface Events { |
| 43 // Fired when the storage device available capacity is changed. | 56 // Fired when the storage device available capacity is changed. |
| 44 // |info|: The changed information for the specified storage unit. | 57 // |info|: The changed information for the specified storage unit. |
| 45 static void onAvailableCapacityChanged(StorageChangeInfo info); | 58 static void onAvailableCapacityChanged(StorageChangeInfo info); |
| 46 | 59 |
| 47 // Fired when a new removable storage is attached to the system. | 60 // Fired when a new removable storage is attached to the system. |
| 48 static void onAttached(StorageUnitInfo info); | 61 static void onAttached(StorageUnitInfo info); |
| 49 | 62 |
| 50 // Fired when a removable storage is detached from the system. | 63 // Fired when a removable storage is detached from the system. |
| 51 static void onDetached(DOMString id); | 64 static void onDetached(DOMString id); |
| 52 }; | 65 }; |
| 53 | 66 |
| 54 }; | 67 }; |
| 55 | 68 |
| OLD | NEW |