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

Side by Side Diff: chrome/common/extensions/api/experimental_system_info_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: Rebase 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.experimental.systemInfo.storage</code> API to query
6 // storage device information and be notified when it changes. 6 // storage device information and be notified when it changes.
7 namespace experimental.systemInfo.storage { 7 namespace experimental.systemInfo.storage {
8 8
9 enum StorageUnitType {
10 // The storage has fixed media, e.g. hard disk or SSD.
11 fixed,
12 // The storage is removable, e.g. USB flash drive.
13 removable,
14 // The storage type is unknown.
15 unknown
16 };
17
18 dictionary StorageUnitInfo {
19 // The unique storage id. It will use the transient ID.
20 DOMString id;
21 // The name of the storage unit.
22 DOMString name;
23 // The media type of the storage unit.
24 StorageUnitType type;
25 // The total amount of the storage space, in bytes.
26 // Default value is 0 if query operation fails.
27 double capacity;
28 // The available amount of the storage space, in bytes.
29 // Default value is 0 if query operation fails.
30 double availableCapacity;
31 };
32
33 [inline_doc] enum EjectDeviceResultCode {
34 // The ejection command is successful -- the application can prompt the user
35 // to remove the device.
36 success,
37 // The device is in use by another application. The ejection did not
38 // succeed; the user should not remove the device until the other
39 // application is done with the device.
40 in_use,
41 // There is no such device known.
42 no_such_device,
43 // The ejection command failed.
44 failure
45 };
46
47 dictionary StorageFreeSpaceChangeInfo { 9 dictionary StorageFreeSpaceChangeInfo {
48 // The transient id of the storage unit already changed. 10 // The transient id of the storage unit already changed.
49 DOMString id; 11 DOMString id;
50 // The new value of the available capacity. 12 // The new value of the available capacity.
51 double availableCapacity; 13 double availableCapacity;
52 }; 14 };
53 15
54 // A dictionary that describes the add particular storage device watch 16 // A dictionary that describes the add particular storage device watch
55 // request results. 17 // request results.
56 dictionary AddWatchResult { 18 dictionary AddWatchResult {
57 DOMString id; 19 DOMString id;
58 boolean success; 20 boolean success;
59 }; 21 };
60 22
61 callback StorageInfoCallback = void (StorageUnitInfo[] info);
62
63 callback EjectDeviceCallback = void (EjectDeviceResultCode result);
64
65 callback AddWatchCallback = void (AddWatchResult info); 23 callback AddWatchCallback = void (AddWatchResult info);
66 24
67 callback GetAllWatchCallback = void (DOMString[] storageIds); 25 callback GetAllWatchCallback = void (DOMString[] storageIds);
68 26
69 interface Functions { 27 interface Functions {
70 // Get the storage information from the system. The argument passed to the
71 // callback is an array of StorageUnitInfo objects.
72 static void get(StorageInfoCallback callback);
73
74 // Ejects a removable storage device.
75 // 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
77 // information.
78 static void ejectDevice(DOMString id, EjectDeviceCallback callback);
79
80 // Monitor a particular storage device available change capacity. 28 // Monitor a particular storage device available change capacity.
81 static void addWatch(DOMString id, AddWatchCallback callback); 29 static void addWatch(DOMString id, AddWatchCallback callback);
82 30
83 // Remove the monitor of a particular device. 31 // Remove the monitor of a particular device.
84 static void removeWatch(DOMString id); 32 static void removeWatch(DOMString id);
85 33
86 // Get all the watched storage devices. 34 // Get all the watched storage devices.
87 static void getAllWatch(GetAllWatchCallback callback); 35 static void getAllWatch(GetAllWatchCallback callback);
88 36
89 // Remove all the storage devices monitors. 37 // Remove all the storage devices monitors.
90 static void removeAllWatch(); 38 static void removeAllWatch();
91 }; 39 };
92 40
93 interface Events { 41 interface Events {
94 // Fired when the storage device available capacity is changed. 42 // Fired when the storage device available capacity is changed.
95 // |info|: The changed information for the specified storage unit. 43 // |info|: The changed information for the specified storage unit.
96 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info); 44 static void onAvailableCapacityChanged(StorageFreeSpaceChangeInfo info);
97
98 // Fired when a new removable storage is attached to the system.
99 static void onAttached(StorageUnitInfo info);
100
101 // Fired when a removable storage is detached from the system.
102 static void onDetached(DOMString id);
103 }; 45 };
104 46
105 }; 47 };
106 48
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698