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

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

Issue 2297043002: Web expose FileSystemFileEntry, FileSystemDirectoryEntry and friends (Closed)
Patch Set: Rebased Created 4 years 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.syncFileSystem</code> API to save and synchronize data 5 // Use the <code>chrome.syncFileSystem</code> API to save and synchronize data
6 // on Google Drive. This API is NOT for accessing arbitrary user docs stored in 6 // on Google Drive. This API is NOT for accessing arbitrary user docs stored in
7 // Google Drive. It provides app-specific syncable storage for offline and 7 // Google Drive. It provides app-specific syncable storage for offline and
8 // caching usage so that the same data can be available across different 8 // caching usage so that the same data can be available across different
9 // clients. Read <a href="app_storage.html">Manage Data</a> for more on using 9 // clients. Read <a href="app_storage.html">Manage Data</a> for more on using
10 // this API. 10 // this API.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 enum ConflictResolutionPolicy { 57 enum ConflictResolutionPolicy {
58 last_write_win, manual 58 last_write_win, manual
59 }; 59 };
60 60
61 dictionary FileInfo { 61 dictionary FileInfo {
62 // <code>fileEntry</code> for the target file whose status has changed. 62 // <code>fileEntry</code> for the target file whose status has changed.
63 // Contains name and path information of synchronized file. 63 // Contains name and path information of synchronized file.
64 // On file deletion, 64 // On file deletion,
65 // <code>fileEntry</code> information will still be available 65 // <code>fileEntry</code> information will still be available
66 // but file will no longer exist. 66 // but file will no longer exist.
67 [instanceOf=Entry] object fileEntry; 67 [instanceOf=FileSystemEntry] object fileEntry;
68 68
69 // Resulting file status after $(ref:onFileStatusChanged) event. 69 // Resulting file status after $(ref:onFileStatusChanged) event.
70 // The status value can be <code>'synced'</code>, 70 // The status value can be <code>'synced'</code>,
71 // <code>'pending'</code> or <code>'conflicting'</code>. 71 // <code>'pending'</code> or <code>'conflicting'</code>.
72 FileStatus status; 72 FileStatus status;
73 73
74 // Sync action taken to fire $(ref:onFileStatusChanged) event. 74 // Sync action taken to fire $(ref:onFileStatusChanged) event.
75 // The action value can be 75 // The action value can be
76 // <code>'added'</code>, <code>'updated'</code> or <code>'deleted'</code>. 76 // <code>'added'</code>, <code>'updated'</code> or <code>'deleted'</code>.
77 // Only applies if status is <code>'synced'</code>. 77 // Only applies if status is <code>'synced'</code>.
78 SyncAction? action; 78 SyncAction? action;
79 79
80 // Sync direction for the $(ref:onFileStatusChanged) event. 80 // Sync direction for the $(ref:onFileStatusChanged) event.
81 // Sync direction value can be 81 // Sync direction value can be
82 // <code>'local_to_remote'</code> or <code>'remote_to_local'</code>. 82 // <code>'local_to_remote'</code> or <code>'remote_to_local'</code>.
83 // Only applies if status is <code>'synced'</code>. 83 // Only applies if status is <code>'synced'</code>.
84 SyncDirection? direction; 84 SyncDirection? direction;
85 }; 85 };
86 86
87 dictionary FileStatusInfo { 87 dictionary FileStatusInfo {
88 // One of the Entry's originally given to getFileStatuses. 88 // One of the FileSystemEntry's originally given to getFileStatuses.
89 [instanceOf=Entry] object fileEntry; 89 [instanceOf=FileSystemEntry] object fileEntry;
90 90
91 // The status value can be <code>'synced'</code>, 91 // The status value can be <code>'synced'</code>,
92 // <code>'pending'</code> or <code>'conflicting'</code>. 92 // <code>'pending'</code> or <code>'conflicting'</code>.
93 FileStatus status; 93 FileStatus status;
94 94
95 // Optional error that is only returned if there was a problem retrieving 95 // Optional error that is only returned if there was a problem retrieving
96 // the FileStatus for the given file. 96 // the FileStatus for the given file.
97 DOMString? error; 97 DOMString? error;
98 }; 98 };
99 99
100 dictionary StorageInfo { 100 dictionary StorageInfo {
101 long usageBytes; 101 long usageBytes;
102 long quotaBytes; 102 long quotaBytes;
103 }; 103 };
104 104
105 dictionary ServiceInfo { 105 dictionary ServiceInfo {
106 ServiceStatus state; 106 ServiceStatus state;
107 DOMString description; 107 DOMString description;
108 }; 108 };
109 109
110 // A callback type for requestFileSystem. 110 // A callback type for requestFileSystem.
111 callback GetFileSystemCallback = 111 callback GetFileSystemCallback =
112 void ([instanceOf=DOMFileSystem] object fileSystem); 112 void ([instanceOf=FileSystem] object fileSystem);
113 113
114 // A callback type for getUsageAndQuota. 114 // A callback type for getUsageAndQuota.
115 callback QuotaAndUsageCallback = void (StorageInfo info); 115 callback QuotaAndUsageCallback = void (StorageInfo info);
116 116
117 // Returns true if operation was successful. 117 // Returns true if operation was successful.
118 callback DeleteFileSystemCallback = void (boolean result); 118 callback DeleteFileSystemCallback = void (boolean result);
119 119
120 // A callback type for getFileStatus. 120 // A callback type for getFileStatus.
121 callback GetFileStatusCallback = void (FileStatus status); 121 callback GetFileStatusCallback = void (FileStatus status);
122 122
123 // A callback type for getFileStatuses. 123 // A callback type for getFileStatuses.
124 callback GetFileStatusesCallback = void (FileStatusInfo[] status); 124 callback GetFileStatusesCallback = void (FileStatusInfo[] status);
125 125
126 // A callback type for getServiceStatus. 126 // A callback type for getServiceStatus.
127 callback GetServiceStatusCallback = void (ServiceStatus status); 127 callback GetServiceStatusCallback = void (ServiceStatus status);
128 128
129 // A callback type for getConflictResolutionPolicy. 129 // A callback type for getConflictResolutionPolicy.
130 callback GetConflictResolutionPolicyCallback = 130 callback GetConflictResolutionPolicyCallback =
131 void (ConflictResolutionPolicy policy); 131 void (ConflictResolutionPolicy policy);
132 132
133 // A generic result callback to indicate success or failure. 133 // A generic result callback to indicate success or failure.
134 callback ResultCallback = void (); 134 callback ResultCallback = void ();
135 135
136 interface Functions { 136 interface Functions {
137 // Returns a syncable filesystem backed by Google Drive. 137 // Returns a syncable filesystem backed by Google Drive.
138 // The returned <code>DOMFileSystem</code> instance can be operated on 138 // The returned <code>FileSystem</code> instance can be operated on
139 // in the same way as the Temporary and Persistant file systems (see 139 // in the same way as the Temporary and Persistant file systems (see
140 // <a href="http://dev.w3.org/2009/dap/file-system/file-dir-sys.html"> 140 // <a href="http://dev.w3.org/2009/dap/file-system/file-dir-sys.html">
141 // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html</a>). 141 // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html</a>).
142 // 142 //
143 // Calling this multiple times from 143 // Calling this multiple times from
144 // the same app will return the same handle to the same file system. 144 // the same app will return the same handle to the same file system.
145 // 145 //
146 // Note this call can fail. For example, if the user is not signed in to 146 // Note this call can fail. For example, if the user is not signed in to
147 // Chrome or if there is no network operation. To handle these errors it is 147 // Chrome or if there is no network operation. To handle these errors it is
148 // important chrome.runtime.lastError is checked in the callback. 148 // important chrome.runtime.lastError is checked in the callback.
(...skipping 10 matching lines...) Expand all
159 static void setConflictResolutionPolicy( 159 static void setConflictResolutionPolicy(
160 ConflictResolutionPolicy policy, 160 ConflictResolutionPolicy policy,
161 optional ResultCallback callback); 161 optional ResultCallback callback);
162 162
163 // Gets the current conflict resolution policy. 163 // Gets the current conflict resolution policy.
164 static void getConflictResolutionPolicy( 164 static void getConflictResolutionPolicy(
165 GetConflictResolutionPolicyCallback callback); 165 GetConflictResolutionPolicyCallback callback);
166 166
167 // Returns the current usage and quota in bytes 167 // Returns the current usage and quota in bytes
168 // for the <code>'syncable'</code> file storage for the app. 168 // for the <code>'syncable'</code> file storage for the app.
169 static void getUsageAndQuota([instanceOf=DOMFileSystem] object fileSystem, 169 static void getUsageAndQuota([instanceOf=FileSystem] object fileSystem,
170 QuotaAndUsageCallback callback); 170 QuotaAndUsageCallback callback);
171 171
172 // Returns the $(ref:FileStatus) for the given <code>fileEntry</code>. 172 // Returns the $(ref:FileStatus) for the given <code>fileEntry</code>.
173 // The status value can be <code>'synced'</code>, 173 // The status value can be <code>'synced'</code>,
174 // <code>'pending'</code> or <code>'conflicting'</code>. 174 // <code>'pending'</code> or <code>'conflicting'</code>.
175 // Note that <code>'conflicting'</code> state only happens when 175 // Note that <code>'conflicting'</code> state only happens when
176 // the service's conflict resolution policy is set to <code>'manual'</code>. 176 // the service's conflict resolution policy is set to <code>'manual'</code>.
177 static void getFileStatus([instanceOf=Entry] object fileEntry, 177 static void getFileStatus([instanceOf=FileSystemEntry] object fileEntry,
178 GetFileStatusCallback callback); 178 GetFileStatusCallback callback);
179 179
180 // Returns each $(ref:FileStatus) for the given <code>fileEntry</code> array . 180 // Returns each $(ref:FileStatus) for the given <code>fileEntry</code> array .
181 // Typically called with the result from dirReader.readEntries(). 181 // Typically called with the result from dirReader.readEntries().
182 static void getFileStatuses(object[] fileEntries, 182 static void getFileStatuses(object[] fileEntries,
183 GetFileStatusesCallback callback); 183 GetFileStatusesCallback callback);
184 184
185 // Returns the current sync backend status. 185 // Returns the current sync backend status.
186 static void getServiceStatus(GetServiceStatusCallback callback); 186 static void getServiceStatus(GetServiceStatusCallback callback);
187 }; 187 };
188 188
189 interface Events { 189 interface Events {
190 // Fired when an error or other status change has happened in the 190 // Fired when an error or other status change has happened in the
191 // sync backend (for example, when the sync is temporarily disabled due to 191 // sync backend (for example, when the sync is temporarily disabled due to
192 // network or authentication error). 192 // network or authentication error).
193 static void onServiceStatusChanged(ServiceInfo detail); 193 static void onServiceStatusChanged(ServiceInfo detail);
194 194
195 // Fired when a file has been updated by the background sync service. 195 // Fired when a file has been updated by the background sync service.
196 static void onFileStatusChanged(FileInfo detail); 196 static void onFileStatusChanged(FileInfo detail);
197 }; 197 };
198 198
199 }; 199 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698