Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.system.storage</code> API to query storage device | 5 // Use the <code>chrome.system.storage</code> API to query storage device |
| 6 // information and be notified when a removable storage device is attached and | 6 // information and be notified when a removable storage device is attached and |
| 7 // detached. | 7 // detached. |
| 8 namespace system.storage { | 8 namespace system.storage { |
| 9 | 9 |
| 10 enum StorageUnitType { | 10 enum StorageUnitType { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 // application, or between different applications. | 23 // application, or between different applications. |
| 24 DOMString id; | 24 DOMString id; |
| 25 // The name of the storage unit. | 25 // The name of the storage unit. |
| 26 DOMString name; | 26 DOMString name; |
| 27 // The media type of the storage unit. | 27 // The media type of the storage unit. |
| 28 StorageUnitType type; | 28 StorageUnitType type; |
| 29 // The total amount of the storage space, in bytes. | 29 // The total amount of the storage space, in bytes. |
| 30 double capacity; | 30 double capacity; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 dictionary StorageAvailableCapacityInfo { | |
| 34 DOMString id; | |
|
Greg Billock
2013/10/14 20:32:05
Can we arrange to pass this in JS and just return
Haojian Wu
2013/10/15 00:50:26
Yes. We can just return the capacity instead of th
Greg Billock
2013/10/15 15:26:04
Sounds good.
On 2013/10/15 00:50:26, Haojian Wu w
Greg Billock
2013/10/15 15:26:04
Add a comment about this id that it is the same ID
Haojian Wu
2013/10/16 04:04:23
Done.
| |
| 35 // The available capacity of the storage device, in bytes. | |
| 36 double availableCapacity; | |
| 37 }; | |
| 38 | |
| 33 [inline_doc] enum EjectDeviceResultCode { | 39 [inline_doc] enum EjectDeviceResultCode { |
| 34 // The ejection command is successful -- the application can prompt the user | 40 // The ejection command is successful -- the application can prompt the user |
| 35 // to remove the device. | 41 // to remove the device. |
| 36 success, | 42 success, |
| 37 // The device is in use by another application. The ejection did not | 43 // The device is in use by another application. The ejection did not |
| 38 // succeed; the user should not remove the device until the other | 44 // succeed; the user should not remove the device until the other |
| 39 // application is done with the device. | 45 // application is done with the device. |
| 40 in_use, | 46 in_use, |
| 41 // There is no such device known. | 47 // There is no such device known. |
| 42 no_such_device, | 48 no_such_device, |
| 43 // The ejection command failed. | 49 // The ejection command failed. |
| 44 failure | 50 failure |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 callback EjectDeviceCallback = void (EjectDeviceResultCode result); | 53 callback EjectDeviceCallback = void (EjectDeviceResultCode result); |
| 48 | 54 |
| 49 callback StorageInfoCallback = void (StorageUnitInfo[] info); | 55 callback StorageInfoCallback = void (StorageUnitInfo[] info); |
| 50 | 56 |
| 57 callback getAvailableCapacityCallback = void ( | |
| 58 StorageAvailableCapacityInfo info); | |
| 59 | |
| 51 interface Functions { | 60 interface Functions { |
| 52 // Get the storage information from the system. The argument passed to the | 61 // Get the storage information from the system. The argument passed to the |
| 53 // callback is an array of StorageUnitInfo objects. | 62 // callback is an array of StorageUnitInfo objects. |
| 54 static void getInfo(StorageInfoCallback callback); | 63 static void getInfo(StorageInfoCallback callback); |
| 55 | 64 |
| 56 // Ejects a removable storage device. | 65 // Ejects a removable storage device. |
| 57 static void ejectDevice(DOMString id, EjectDeviceCallback callback); | 66 static void ejectDevice(DOMString id, EjectDeviceCallback callback); |
| 67 | |
| 68 // Get the available capacity of a specified |id| storage device. | |
|
Greg Billock
2013/10/15 15:26:04
Clarify here about id: "... of a specified storage
Haojian Wu
2013/10/16 04:04:23
Done.
| |
| 69 static void getAvailableCapacity(DOMString id, | |
| 70 getAvailableCapacityCallback callback); | |
| 58 }; | 71 }; |
| 59 | 72 |
| 60 interface Events { | 73 interface Events { |
| 61 // Fired when a new removable storage is attached to the system. | 74 // Fired when a new removable storage is attached to the system. |
| 62 static void onAttached(StorageUnitInfo info); | 75 static void onAttached(StorageUnitInfo info); |
| 63 | 76 |
| 64 // Fired when a removable storage is detached from the system. | 77 // Fired when a removable storage is detached from the system. |
| 65 static void onDetached(DOMString id); | 78 static void onDetached(DOMString id); |
| 66 }; | 79 }; |
| 67 | 80 |
| 68 }; | 81 }; |
| 69 | |
| OLD | NEW |