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. |
| 18 DOMString id; | 18 DOMString id; |
| 19 // The mount path of the storage unit. | |
| 20 DOMString location; | |
|
Greg Billock
2013/06/18 18:24:52
Does this get exposed to apps? That seems like a p
Haojian Wu
2013/06/21 05:49:04
Currently I'm not sure. The systemInfo.storage api
Hongbo Min
2013/06/22 09:52:28
The reason why it should be exposed is, it could t
Greg Billock
2013/06/24 16:55:38
That's sensible. I think we should work to make th
Hongbo Min
2013/06/25 01:55:07
Agree!
Haojian Wu
2013/06/26 03:22:39
Does this means changing the IDL name "location" t
Greg Billock
2013/06/26 17:32:48
Yes. That sounds right. I saw a note from Steve th
Haojian Wu
2013/06/27 09:17:59
Done.
| |
| 19 // The media type of the storage unit. | 21 // The media type of the storage unit. |
| 20 StorageUnitType type; | 22 StorageUnitType type; |
| 21 // The total amount of the storage space, in bytes. | 23 // The total amount of the storage space, in bytes. |
|
Greg Billock
2013/06/18 18:24:52
Document what the default values are in case we ca
Haojian Wu
2013/06/21 05:49:04
Done.
| |
| 22 double capacity; | 24 double capacity; |
| 23 // The available amount of the storage space, in bytes. | 25 // The available amount of the storage space, in bytes. |
| 24 double availableCapacity; | 26 double availableCapacity; |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 dictionary StorageChangeInfo { | 29 dictionary StorageChangeInfo { |
|
Greg Billock
2013/06/18 18:24:52
How about "StorageCapacityChangeInfo"?
Haojian Wu
2013/06/21 05:49:04
Done.
Haojian Wu
2013/06/23 07:59:16
Now I doubt whether we should change the name here
Greg Billock
2013/06/24 16:55:38
I think the new name is fine -- we can update the
| |
| 28 // The uniue id of the storage unit already changed. | 30 // The uniue id of the storage unit already changed. |
|
Greg Billock
2013/06/18 18:24:52
"unique"
Haojian Wu
2013/06/21 05:49:04
Done.
| |
| 29 DOMString id; | 31 DOMString id; |
| 30 // The new value of the available capacity. | 32 // The new value of the available capacity. |
| 31 double availableCapacity; | 33 double availableCapacity; |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 // A dictionary that describes the add particular storage device watch | 36 // A dictionary that describes the add particular storage device watch |
| 35 // request results. | 37 // request results. |
| 36 dictionary AddWatchResult { | 38 dictionary AddWatchResult { |
| 37 DOMString id; | 39 DOMString id; |
| 38 boolean success; | 40 boolean success; |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 callback StorageInfoCallback = void (StorageUnitInfo[] info); | 43 callback StorageInfoCallback = void (StorageUnitInfo[] info); |
| 42 | 44 |
| 43 callback AddWatchCallback = void (AddWatchResult info); | 45 callback AddWatchCallback = void (AddWatchResult info); |
| 44 | 46 |
| 45 callback GetAllWatchCallback = void (DOMString[] storageIds); | 47 callback GetAllWatchCallback = void (DOMString[] storageIds); |
| 46 | 48 |
| 47 interface Functions { | 49 interface Functions { |
| 48 // 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 |
| 49 // callback is an array of StorageUnitInfo objects. | 51 // callback is an array of StorageUnitInfo objects. |
| 50 static void get(StorageInfoCallback callback); | 52 static void get(StorageInfoCallback callback); |
| 51 | 53 |
| 52 // Monitor a particular storage device available change capacity. | 54 // Monitor a particular storage device available change capacity. |
| 53 static void addWatch(DOMString id, AddWatchCallback callback); | 55 static void addWatch(DOMString id, AddWatchCallback callback); |
|
Greg Billock
2013/06/18 18:24:52
Should attachment/detachment notifications be spli
Haojian Wu
2013/06/21 05:49:04
Here we keep the systemInfo storage api definition
Hongbo Min
2013/06/22 09:52:28
Haojian, please have a look at https://code.google
Greg Billock
2013/06/24 16:55:38
Yeah, these are going to split as most of the API
| |
| 54 | 56 |
| 55 // Remove the monitor of a particular device. | 57 // Remove the monitor of a particular device. |
| 56 static void removeWatch(DOMString id); | 58 static void removeWatch(DOMString id); |
| 57 | 59 |
| 58 // Get all the watched storage devices. | 60 // Get all the watched storage devices. |
| 59 static void getAllWatch(GetAllWatchCallback callback); | 61 static void getAllWatch(GetAllWatchCallback callback); |
| 60 | 62 |
| 61 // Remove all the storage devices monitors. | 63 // Remove all the storage devices monitors. |
| 62 static void removeAllWatch(); | 64 static void removeAllWatch(); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 interface Events { | 67 interface Events { |
| 66 // Fired when the storage device available capacity is changed. | 68 // Fired when the storage device available capacity is changed. |
| 67 // |info|: The changed information for the specified storage unit. | 69 // |info|: The changed information for the specified storage unit. |
| 68 static void onAvailableCapacityChanged(StorageChangeInfo info); | 70 static void onAvailableCapacityChanged(StorageChangeInfo info); |
| 69 | 71 |
| 70 // Fired when a new removable storage is attached to the system. | 72 // Fired when a new removable storage is attached to the system. |
| 71 static void onAttached(StorageUnitInfo info); | 73 static void onAttached(StorageUnitInfo info); |
| 72 | 74 |
| 73 // Fired when a removable storage is detached from the system. | 75 // Fired when a removable storage is detached from the system. |
| 74 static void onDetached(DOMString id); | 76 static void onDetached(DOMString id); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 }; | 79 }; |
| 78 | 80 |
| OLD | NEW |