Chromium Code Reviews| Index: chrome/common/extensions/api/experimental_system_info_storage.idl |
| diff --git a/chrome/common/extensions/api/experimental_system_info_storage.idl b/chrome/common/extensions/api/experimental_system_info_storage.idl |
| index 13ed295ad85680c962d6bbd15ee947ba84792429..dd851555f18a149aeb6381c8a0778e0a223e0020 100644 |
| --- a/chrome/common/extensions/api/experimental_system_info_storage.idl |
| +++ b/chrome/common/extensions/api/experimental_system_info_storage.idl |
| @@ -32,8 +32,21 @@ namespace experimental.systemInfo.storage { |
| double availableCapacity; |
| }; |
| + // EventOption is used to filter the free space event. Only the conditions |
| + // required by EventOption are both satisfied, the free space change event |
| + // gets fired. |
| + dictionary EventOption { |
| + // The ID of storage unit being watched. |
| + DOMString id; |
| + // The minimum value of the available capacity changed to fire free space |
| + // change event, in bytes. Default value is 1024 bytes (1K). |
| + long? changeThreshold; |
| + }; |
| + |
| callback StorageInfoCallback = void (StorageUnitInfo[] info); |
| + callback StorageChangeCallback = void (StorageChangeInfo changeInfo); |
| + |
| interface Functions { |
| // Get the storage information from the system. The argument passed to the |
| // callback is an array of StorageUnitInfo objects. |
| @@ -41,9 +54,31 @@ namespace experimental.systemInfo.storage { |
| }; |
| interface Events { |
| - // Fired when the storage information is updated. |
| - // |info| : The changed information for the specified storage unit |
| - static void onAvailableCapacityChanged(StorageChangeInfo info); |
| + // Fired when the storage free space is changed. To register an event |
| + // listener for storage change event, a variant of the general <code> |
| + // addListener()<code> function of <code>chrome.Event</code> is provided. |
| + // In addtional to specifying a callback function, you have to specify |
|
benwells
2012/12/11 04:40:40
nit: addition
|
| + // an event option argument used to filter the event. |
| + // |
| + // The 2 arguments to <code>addListener()</code> have the following |
| + // definitions: |
| + // <code> |
| + // chrome.experimental.systemInfo.storage.onChanged.addListener( |
| + // function callback, EventOption eventOption); |
| + // callback = function(StorageChangeInfo details); |
| + // </code> |
| + // |
| + // Here's an example of listening <code>onChanged</code> event: |
| + // <code> |
| + // chrome.experimental.systemInfo.storage.onChanged.addListener( |
| + // function(details) {}, {id: <id>, changeThreshold: 1000}); |
| + // </code> |
| + // Where <code>id<code> parameter is the storage id returned from <code> |
| + // chrome.experimental.systemInfo.get</code> calling, and <code> |
| + // changeThreshold</code> means the minimum changed bytes of the free |
| + // space to trigger the event for the specified storage. Default change |
| + // threshold is 1024 bytes. |
| + static void onChanged(StorageChangeInfo info); |
| }; |
| }; |