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 // The same |id| from the getAvailableCapacity function parameter |id|. | |
|
not at google - send to devlin
2013/10/18 00:33:11
I can't parse this sentence
Haojian Wu
2013/10/18 00:47:38
Done.
| |
| 35 DOMString id; | |
| 36 // The available capacity of the storage device, in bytes. | |
| 37 double availableCapacity; | |
| 38 }; | |
| 39 | |
| 33 [inline_doc] enum EjectDeviceResultCode { | 40 [inline_doc] enum EjectDeviceResultCode { |
| 34 // The ejection command is successful -- the application can prompt the user | 41 // The ejection command is successful -- the application can prompt the user |
| 35 // to remove the device. | 42 // to remove the device. |
| 36 success, | 43 success, |
| 37 // The device is in use by another application. The ejection did not | 44 // The device is in use by another application. The ejection did not |
| 38 // succeed; the user should not remove the device until the other | 45 // succeed; the user should not remove the device until the other |
| 39 // application is done with the device. | 46 // application is done with the device. |
| 40 in_use, | 47 in_use, |
| 41 // There is no such device known. | 48 // There is no such device known. |
| 42 no_such_device, | 49 no_such_device, |
| 43 // The ejection command failed. | 50 // The ejection command failed. |
| 44 failure | 51 failure |
| 45 }; | 52 }; |
| 46 | 53 |
| 47 callback EjectDeviceCallback = void (EjectDeviceResultCode result); | 54 callback EjectDeviceCallback = void (EjectDeviceResultCode result); |
| 48 | 55 |
| 49 callback StorageInfoCallback = void (StorageUnitInfo[] info); | 56 callback StorageInfoCallback = void (StorageUnitInfo[] info); |
| 50 | 57 |
| 58 callback getAvailableCapacityCallback = void ( | |
|
not at google - send to devlin
2013/10/18 00:33:11
get -> Get
Haojian Wu
2013/10/18 00:47:38
The extension api name should follow this way(the
| |
| 59 StorageAvailableCapacityInfo info); | |
| 60 | |
| 51 interface Functions { | 61 interface Functions { |
| 52 // Get the storage information from the system. The argument passed to the | 62 // Get the storage information from the system. The argument passed to the |
| 53 // callback is an array of StorageUnitInfo objects. | 63 // callback is an array of StorageUnitInfo objects. |
| 54 static void getInfo(StorageInfoCallback callback); | 64 static void getInfo(StorageInfoCallback callback); |
| 55 | 65 |
| 56 // Ejects a removable storage device. | 66 // Ejects a removable storage device. |
| 57 static void ejectDevice(DOMString id, EjectDeviceCallback callback); | 67 static void ejectDevice(DOMString id, EjectDeviceCallback callback); |
| 68 | |
| 69 // Get the available capacity of a specified |id| storage device. | |
| 70 // The |id| is the transient device ID from StorageUnitInfo. | |
| 71 static void getAvailableCapacity(DOMString id, | |
| 72 getAvailableCapacityCallback callback); | |
| 58 }; | 73 }; |
| 59 | 74 |
| 60 interface Events { | 75 interface Events { |
| 61 // Fired when a new removable storage is attached to the system. | 76 // Fired when a new removable storage is attached to the system. |
| 62 static void onAttached(StorageUnitInfo info); | 77 static void onAttached(StorageUnitInfo info); |
| 63 | 78 |
| 64 // Fired when a removable storage is detached from the system. | 79 // Fired when a removable storage is detached from the system. |
| 65 static void onDetached(DOMString id); | 80 static void onDetached(DOMString id); |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 }; | 83 }; |
| 69 | |
| OLD | NEW |