Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/common/extensions/api/system_storage.idl

Issue 18578008: [SystemInfo API] Move Storage API out of experimental namespace and rename to the "system" namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to the "system" namespace. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Use the <code>chrome.experimental.systemInfo.storage</code> API to query 5 // Use the <code>chrome.system.storage</code> API to query
6 // storage device information and be notified when it changes. 6 // storage device information and be notified when a removable storage device is
7 namespace experimental.systemInfo.storage { 7 // attached and detached or the available capacity changes.
8 namespace system.storage {
8 9
9 enum StorageUnitType { 10 enum StorageUnitType {
10 // The storage has fixed media, e.g. hard disk or SSD. 11 // The storage has fixed media, e.g. hard disk or SSD.
11 fixed, 12 fixed,
12 // The storage is removable, e.g. USB flash drive. 13 // The storage is removable, e.g. USB flash drive.
13 removable, 14 removable,
14 // The storage type is unknown. 15 // The storage type is unknown.
15 unknown 16 unknown
16 }; 17 };
17 18
18 dictionary StorageUnitInfo { 19 dictionary StorageUnitInfo {
19 // The unique storage id. It will use the transient ID. 20 // The unique storage id. It will use the transient ID.
20 DOMString id; 21 DOMString id;
21 // The name of the storage unit. 22 // The name of the storage unit.
22 DOMString name; 23 DOMString name;
23 // The media type of the storage unit. 24 // The media type of the storage unit.
24 StorageUnitType type; 25 StorageUnitType type;
25 // The total amount of the storage space, in bytes. 26 // The total amount of the storage space, in bytes.
26 // Default value is 0 if query operation fails.
27 double capacity; 27 double capacity;
28 // The available amount of the storage space, in bytes. 28 };
29 // Default value is 0 if query operation fails. 29
30 dictionary StorageFreeSpaceChangeInfo {
31 // The transient id of the storage unit already changed.
32 DOMString id;
33 // The new value of the available capacity.
30 double availableCapacity; 34 double availableCapacity;
31 }; 35 };
32 36
37 // A dictionary that describes the add particular storage device watch
38 // request results.
39 dictionary AddAvailableCapacityWatchResult {
40 DOMString id;
41 boolean success;
42 };
43
33 [inline_doc] enum EjectDeviceResultCode { 44 [inline_doc] enum EjectDeviceResultCode {
34 // The ejection command is successful -- the application can prompt the user 45 // The ejection command is successful -- the application can prompt the user
35 // to remove the device. 46 // to remove the device.
36 success, 47 success,
37 // The device is in use by another application. The ejection did not 48 // The device is in use by another application. The ejection did not
38 // succeed; the user should not remove the device until the other 49 // succeed; the user should not remove the device until the other
39 // application is done with the device. 50 // application is done with the device.
40 in_use, 51 in_use,
41 // There is no such device known. 52 // There is no such device known.
42 no_such_device, 53 no_such_device,
43 // The ejection command failed. 54 // The ejection command failed.
44 failure 55 failure
45 }; 56 };
46 57
47 dictionary StorageFreeSpaceChangeInfo { 58 callback AddAvailableCapacityWatchCallback = void (
48 // The transient id of the storage unit already changed. 59 AddAvailableCapacityWatchResult info);
49 DOMString id;
50 // The new value of the available capacity.
51 double availableCapacity;
52 };
53 60
54 // A dictionary that describes the add particular storage device watch 61 callback GetAllAvailableCapacityWatchesCallback = void (
55 // request results. 62 DOMString[] storageIds);
56 dictionary AddWatchResult { 63
57 DOMString id; 64 callback EjectDeviceCallback = void (EjectDeviceResultCode result);
58 boolean success;
59 };
60 65
61 callback StorageInfoCallback = void (StorageUnitInfo[] info); 66 callback StorageInfoCallback = void (StorageUnitInfo[] info);
62 67
63 callback EjectDeviceCallback = void (EjectDeviceResultCode result);
64
65 callback AddWatchCallback = void (AddWatchResult info);
66
67 callback GetAllWatchCallback = void (DOMString[] storageIds);
68
69 interface Functions { 68 interface Functions {
70 // Get the storage information from the system. The argument passed to the 69 // Get the storage information from the system. The argument passed to the
71 // callback is an array of StorageUnitInfo objects. 70 // callback is an array of StorageUnitInfo objects.
72 static void get(StorageInfoCallback callback); 71 static void get(StorageInfoCallback callback);
73 72
74 // Ejects a removable storage device. 73 // Ejects a removable storage device.
75 // Note: We plan to move this function into a namespace that indicates it 74 // Note: We plan to move this function into a namespace that indicates it
76 // that modifies the state of the system rather than just gathering 75 // that modifies the state of the system rather than just gathering
77 // information. 76 // information.
78 static void ejectDevice(DOMString id, EjectDeviceCallback callback); 77 static void ejectDevice(DOMString id, EjectDeviceCallback callback);
79 78
80 // Monitor a particular storage device available change capacity. 79 // Monitor a particular storage device available change capacity.
81 static void addWatch(DOMString id, AddWatchCallback callback); 80 static void addAvailableCapacityWatch(
81 DOMString id,
82 AddAvailableCapacityWatchCallback callback);
82 83
83 // Remove the monitor of a particular device. 84 // Remove the monitor of a particular device.
84 static void removeWatch(DOMString id); 85 static void removeAvailableCapacityWatch(DOMString id);
85 86
86 // Get all the watched storage devices. 87 // Get all the watched storage devices.
87 static void getAllWatch(GetAllWatchCallback callback); 88 static void getAllAvailableCapacityWatches(
89 GetAllAvailableCapacityWatchesCallback callback);
88 90
89 // Remove all the storage devices monitors. 91 // Remove all the storage devices monitors.
90 static void removeAllWatch(); 92 static void removeAllAvailableCapacityWatches();
91 }; 93 };
92 94
93 interface Events { 95 interface Events {
94 // Fired when the storage device available capacity is changed.
95 // |info|: The changed information for the specified storage unit.
96 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info);
97
98 // Fired when a new removable storage is attached to the system. 96 // Fired when a new removable storage is attached to the system.
99 static void onAttached(StorageUnitInfo info); 97 static void onAttached(StorageUnitInfo info);
100 98
101 // Fired when a removable storage is detached from the system. 99 // Fired when a removable storage is detached from the system.
102 static void onDetached(DOMString id); 100 static void onDetached(DOMString id);
101
102 // Fired when the storage device available capacity is changed.
103 // |info|: The changed information for the specified storage unit.
104 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info);
103 }; 105 };
104 106
105 }; 107 };
106 108
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698