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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.h

Issue 10271026: gdata: Add GDataFileSystem::ReadDirectoryByPathAsync() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
7 #pragma once 7 #pragma once
8 8
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const std::string& mime_type, 68 const std::string& mime_type,
69 GDataFileType file_type)> 69 GDataFileType file_type)>
70 GetFileCallback; 70 GetFileCallback;
71 71
72 // Used to get file info from the file system. 72 // Used to get file info from the file system.
73 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL. 73 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL.
74 typedef base::Callback<void(base::PlatformFileError error, 74 typedef base::Callback<void(base::PlatformFileError error,
75 scoped_ptr<GDataFileProto> file_proto)> 75 scoped_ptr<GDataFileProto> file_proto)>
76 GetFileInfoCallback; 76 GetFileInfoCallback;
77 77
78 // Used to read a directory from the file system.
79 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL.
80 typedef base::Callback<void(base::PlatformFileError error,
81 scoped_ptr<GDataDirectoryProto> directory_proto)>
82 ReadDirectoryCallback;
83
78 // Callback for SetMountedState. 84 // Callback for SetMountedState.
79 typedef base::Callback<void(base::PlatformFileError error, 85 typedef base::Callback<void(base::PlatformFileError error,
80 const FilePath& file_path)> 86 const FilePath& file_path)>
81 SetMountedStateCallback; 87 SetMountedStateCallback;
82 88
83 // Used for file operations like removing files. 89 // Used for file operations like removing files.
84 typedef base::Callback<void(base::PlatformFileError error, 90 typedef base::Callback<void(base::PlatformFileError error,
85 base::ListValue* feed_list)> 91 base::ListValue* feed_list)>
86 GetJsonDocumentCallback; 92 GetJsonDocumentCallback;
87 93
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Gets the cache state of file corresponding to |resource_id| and |md5| if it 312 // Gets the cache state of file corresponding to |resource_id| and |md5| if it
307 // exists on disk. 313 // exists on disk.
308 // Initializes cache if it has not been initialized. 314 // Initializes cache if it has not been initialized.
309 // Upon completion, |callback| is invoked on the thread where this method was 315 // Upon completion, |callback| is invoked on the thread where this method was
310 // called with the cache state if file exists in cache or CACHE_STATE_NONE 316 // called with the cache state if file exists in cache or CACHE_STATE_NONE
311 // otherwise. 317 // otherwise.
312 virtual void GetCacheState(const std::string& resource_id, 318 virtual void GetCacheState(const std::string& resource_id,
313 const std::string& md5, 319 const std::string& md5,
314 const GetCacheStateCallback& callback) = 0; 320 const GetCacheStateCallback& callback) = 0;
315 321
316 // Finds a file (not a directory) by |file_path| and returns its key 322 // Finds a file (not a directory) by |file_path|. This call will also
317 // |properties|. Returns true if file was found. 323 // retrieve and refresh file system content from server and disk cache.
324 //
325 // Can be called from UI/IO thread. |callback| is run on the calling thread.
318 virtual void GetFileInfoByPathAsync(const FilePath& file_path, 326 virtual void GetFileInfoByPathAsync(const FilePath& file_path,
319 const GetFileInfoCallback& callback) = 0; 327 const GetFileInfoCallback& callback) = 0;
320 328
329 // Finds and reads a directory by |file_path|. This call will also retrieve
330 // and refresh file system content from server and disk cache.
331 //
332 // Can be called from UI/IO thread. |callback| is run on the calling thread.
333 virtual void ReadDirectoryByPathAsync(
334 const FilePath& file_path,
335 const ReadDirectoryCallback& callback) = 0;
336
321 // Finds a file (not a directory) by |file_path| and returns its key 337 // Finds a file (not a directory) by |file_path| and returns its key
322 // |properties|. Returns true if file was found. 338 // |properties|. Returns true if file was found.
323 // TODO(satorux): Remove this: crosbug.com/30066. 339 // TODO(satorux): Remove this: crosbug.com/30066.
324 virtual bool GetFileInfoByPath(const FilePath& file_path, 340 virtual bool GetFileInfoByPath(const FilePath& file_path,
325 GDataFileProperties* properties) = 0; 341 GDataFileProperties* properties) = 0;
326 342
327 // Returns true if the given path is under gdata cache directory, i.e. 343 // Returns true if the given path is under gdata cache directory, i.e.
328 // <user_profile_dir>/GCache/v1 344 // <user_profile_dir>/GCache/v1
329 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const = 0; 345 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const = 0;
330 346
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 const std::string& resource_id, 422 const std::string& resource_id,
407 const GetFileCallback& get_file_callback, 423 const GetFileCallback& get_file_callback,
408 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; 424 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE;
409 virtual GDataOperationRegistry* GetOperationRegistry() OVERRIDE; 425 virtual GDataOperationRegistry* GetOperationRegistry() OVERRIDE;
410 virtual void GetCacheState(const std::string& resource_id, 426 virtual void GetCacheState(const std::string& resource_id,
411 const std::string& md5, 427 const std::string& md5,
412 const GetCacheStateCallback& callback) OVERRIDE; 428 const GetCacheStateCallback& callback) OVERRIDE;
413 virtual void GetFileInfoByPathAsync( 429 virtual void GetFileInfoByPathAsync(
414 const FilePath& file_path, 430 const FilePath& file_path,
415 const GetFileInfoCallback& callback) OVERRIDE; 431 const GetFileInfoCallback& callback) OVERRIDE;
432 virtual void ReadDirectoryByPathAsync(
433 const FilePath& file_path,
434 const ReadDirectoryCallback& callback) OVERRIDE;
416 virtual bool GetFileInfoByPath(const FilePath& file_path, 435 virtual bool GetFileInfoByPath(const FilePath& file_path,
417 GDataFileProperties* properties) OVERRIDE; 436 GDataFileProperties* properties) OVERRIDE;
418 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE; 437 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE;
419 virtual FilePath GetCacheDirectoryPath( 438 virtual FilePath GetCacheDirectoryPath(
420 GDataRootDirectory::CacheSubDirectoryType sub_dir_type) const OVERRIDE; 439 GDataRootDirectory::CacheSubDirectoryType sub_dir_type) const OVERRIDE;
421 virtual FilePath GetCacheFilePath( 440 virtual FilePath GetCacheFilePath(
422 const std::string& resource_id, 441 const std::string& resource_id,
423 const std::string& md5, 442 const std::string& md5,
424 GDataRootDirectory::CacheSubDirectoryType sub_dir_type, 443 GDataRootDirectory::CacheSubDirectoryType sub_dir_type,
425 CachedFileOrigin file_orign) const OVERRIDE; 444 CachedFileOrigin file_orign) const OVERRIDE;
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 base::PlatformFileError error, 1223 base::PlatformFileError error,
1205 const std::string& resource_id, 1224 const std::string& resource_id,
1206 const std::string& md5); 1225 const std::string& md5);
1207 1226
1208 // Changes state of hosted documents visibility, triggers directory refresh. 1227 // Changes state of hosted documents visibility, triggers directory refresh.
1209 void SetHideHostedDocuments(bool hide); 1228 void SetHideHostedDocuments(bool hide);
1210 1229
1211 // Initializes preference change observer. 1230 // Initializes preference change observer.
1212 void InitializePreferenceObserver(); 1231 void InitializePreferenceObserver();
1213 1232
1214 // Called when an entry is found for GetFileInfoByPath(). 1233 // Called when an entry is found for GetFileInfoByPathAsync().
1215 void OnEntryFound(const GetFileInfoCallback& callback, 1234 void OnGetFileInfo(const GetFileInfoCallback& callback,
1216 base::PlatformFileError error, 1235 base::PlatformFileError error,
1217 const FilePath& directory_path, 1236 const FilePath& directory_path,
1218 GDataEntry* entry); 1237 GDataEntry* entry);
1238
1239 // Called when an entry is found for ReadDirectoryByPathAsync().
1240 void OnReadDirectory(const ReadDirectoryCallback& callback,
1241 base::PlatformFileError error,
1242 const FilePath& directory_path,
1243 GDataEntry* entry);
1219 1244
1220 // The following functions are used to forward calls to asynchronous public 1245 // The following functions are used to forward calls to asynchronous public
1221 // member functions to UI thread. 1246 // member functions to UI thread.
1222 void FindEntryByPathAsyncOnUIThread(const FilePath& search_file_path, 1247 void FindEntryByPathAsyncOnUIThread(const FilePath& search_file_path,
1223 const FindEntryCallback& callback); 1248 const FindEntryCallback& callback);
1224 void CopyOnUIThread(const FilePath& src_file_path, 1249 void CopyOnUIThread(const FilePath& src_file_path,
1225 const FilePath& dest_file_path, 1250 const FilePath& dest_file_path,
1226 const FileOperationCallback& callback); 1251 const FileOperationCallback& callback);
1227 void MoveOnUIThread(const FilePath& src_file_path, 1252 void MoveOnUIThread(const FilePath& src_file_path,
1228 const FilePath& dest_file_path, 1253 const FilePath& dest_file_path,
1229 const FileOperationCallback& callback); 1254 const FileOperationCallback& callback);
1230 void RemoveOnUIThread(const FilePath& file_path, 1255 void RemoveOnUIThread(const FilePath& file_path,
1231 bool is_recursive, 1256 bool is_recursive,
1232 const FileOperationCallback& callback); 1257 const FileOperationCallback& callback);
1233 void CreateDirectoryOnUIThread(const FilePath& directory_path, 1258 void CreateDirectoryOnUIThread(const FilePath& directory_path,
1234 bool is_exclusive, 1259 bool is_exclusive,
1235 bool is_recursive, 1260 bool is_recursive,
1236 const FileOperationCallback& callback); 1261 const FileOperationCallback& callback);
1237 void GetFileByPathOnUIThread( 1262 void GetFileByPathOnUIThread(
1238 const FilePath& file_path, 1263 const FilePath& file_path,
1239 const GetFileCallback& get_file_callback, 1264 const GetFileCallback& get_file_callback,
1240 const GetDownloadDataCallback& get_download_data_callback); 1265 const GetDownloadDataCallback& get_download_data_callback);
1241 void GetFileByResourceIdOnUIThread( 1266 void GetFileByResourceIdOnUIThread(
1242 const std::string& resource_id, 1267 const std::string& resource_id,
1243 const GetFileCallback& get_file_callback, 1268 const GetFileCallback& get_file_callback,
1244 const GetDownloadDataCallback& get_download_data_callback); 1269 const GetDownloadDataCallback& get_download_data_callback);
1245 void GetFileInfoByPathAsyncOnUIThread( 1270 void GetFileInfoByPathAsyncOnUIThread(
1246 const FilePath& file_path, 1271 const FilePath& file_path,
1247 const GetFileInfoCallback& callback); 1272 const GetFileInfoCallback& callback);
1273 void ReadDirectoryByPathAsyncOnUIThread(
1274 const FilePath& file_path,
1275 const ReadDirectoryCallback& callback);
1248 void GetCacheStateOnUIThread(const std::string& resource_id, 1276 void GetCacheStateOnUIThread(const std::string& resource_id,
1249 const std::string& md5, 1277 const std::string& md5,
1250 const GetCacheStateCallback& callback); 1278 const GetCacheStateCallback& callback);
1251 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); 1279 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback);
1252 void SetPinStateOnUIThread(const FilePath& file_path, bool to_pin, 1280 void SetPinStateOnUIThread(const FilePath& file_path, bool to_pin,
1253 const FileOperationCallback& callback); 1281 const FileOperationCallback& callback);
1254 void SetMountedStateOnUIThread( 1282 void SetMountedStateOnUIThread(
1255 const FilePath& file_path, 1283 const FilePath& file_path,
1256 bool to_mount, 1284 bool to_mount,
1257 const SetMountedStateCallback& callback); 1285 const SetMountedStateCallback& callback);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 }; 1345 };
1318 1346
1319 // Sets the free disk space getter for testing. 1347 // Sets the free disk space getter for testing.
1320 // The existing getter is deleted. 1348 // The existing getter is deleted.
1321 void SetFreeDiskSpaceGetterForTesting( 1349 void SetFreeDiskSpaceGetterForTesting(
1322 FreeDiskSpaceGetterInterface* getter); 1350 FreeDiskSpaceGetterInterface* getter);
1323 1351
1324 } // namespace gdata 1352 } // namespace gdata
1325 1353
1326 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 1354 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698