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

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: Fix PermissionTest unittest. 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 storage device
6 // storage device information and be notified when it changes. 6 // information and be notified when a removable storage device is attached and
7 namespace experimental.systemInfo.storage { 7 // 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 }; 28 };
29 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.
34 double availableCapacity;
35 };
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
30 [inline_doc] enum EjectDeviceResultCode { 44 [inline_doc] enum EjectDeviceResultCode {
31 // The ejection command is successful -- the application can prompt the user 45 // The ejection command is successful -- the application can prompt the user
32 // to remove the device. 46 // to remove the device.
33 success, 47 success,
34 // 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
35 // succeed; the user should not remove the device until the other 49 // succeed; the user should not remove the device until the other
36 // application is done with the device. 50 // application is done with the device.
37 in_use, 51 in_use,
38 // There is no such device known. 52 // There is no such device known.
39 no_such_device, 53 no_such_device,
40 // The ejection command failed. 54 // The ejection command failed.
41 failure 55 failure
42 }; 56 };
43 57
44 dictionary StorageFreeSpaceChangeInfo { 58 callback AddAvailableCapacityWatchCallback = void (
45 // The transient id of the storage unit already changed. 59 AddAvailableCapacityWatchResult info);
46 DOMString id;
47 // The new value of the available capacity.
48 double availableCapacity;
49 };
50 60
51 // A dictionary that describes the add particular storage device watch 61 callback GetAllAvailableCapacityWatchesCallback = void (
52 // request results. 62 DOMString[] storageIds);
53 dictionary AddWatchResult {
54 DOMString id;
55 boolean success;
56 };
57
58 callback StorageInfoCallback = void (StorageUnitInfo[] info);
59 63
60 callback EjectDeviceCallback = void (EjectDeviceResultCode result); 64 callback EjectDeviceCallback = void (EjectDeviceResultCode result);
61 65
62 callback AddWatchCallback = void (AddWatchResult info); 66 callback StorageInfoCallback = void (StorageUnitInfo[] info);
63
64 callback GetAllWatchCallback = void (DOMString[] storageIds);
65 67
66 interface Functions { 68 interface Functions {
67 // 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
68 // callback is an array of StorageUnitInfo objects. 70 // callback is an array of StorageUnitInfo objects.
69 static void get(StorageInfoCallback callback); 71 static void getInfo(StorageInfoCallback callback);
70 72
71 // Ejects a removable storage device. 73 // Ejects a removable storage device.
72 // 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
73 // that modifies the state of the system rather than just gathering 75 // that modifies the state of the system rather than just gathering
74 // information. 76 // information.
75 static void ejectDevice(DOMString id, EjectDeviceCallback callback); 77 static void ejectDevice(DOMString id, EjectDeviceCallback callback);
76 78
77 // Monitor a particular storage device available change capacity. 79 // Monitor a particular storage device available change capacity.
78 static void addWatch(DOMString id, AddWatchCallback callback); 80 static void addAvailableCapacityWatch(
81 DOMString id,
82 AddAvailableCapacityWatchCallback callback);
79 83
80 // Remove the monitor of a particular device. 84 // Remove the monitor of a particular device.
81 static void removeWatch(DOMString id); 85 static void removeAvailableCapacityWatch(DOMString id);
82 86
83 // Get all the watched storage devices. 87 // Get all the watched storage devices.
84 static void getAllWatch(GetAllWatchCallback callback); 88 static void getAllAvailableCapacityWatches(
89 GetAllAvailableCapacityWatchesCallback callback);
85 90
86 // Remove all the storage devices monitors. 91 // Remove all the storage devices monitors.
87 static void removeAllWatch(); 92 static void removeAllAvailableCapacityWatches();
88 }; 93 };
89 94
90 interface Events { 95 interface Events {
91 // Fired when the storage device available capacity is changed.
92 // |info|: The changed information for the specified storage unit.
93 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info);
94
95 // Fired when a new removable storage is attached to the system. 96 // Fired when a new removable storage is attached to the system.
96 static void onAttached(StorageUnitInfo info); 97 static void onAttached(StorageUnitInfo info);
97 98
98 // Fired when a removable storage is detached from the system. 99 // Fired when a removable storage is detached from the system.
99 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);
100 }; 105 };
101 106
102 }; 107 };
103 108
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698