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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_interface.h

Issue 214363002: drive: Return cancel closure from FileSystem::GetFileContent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
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_DRIVE_FILE_SYSTEM_INTERFACE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 scoped_ptr<ResourceEntry> entry)> 64 scoped_ptr<ResourceEntry> entry)>
65 GetResourceEntryCallback; 65 GetResourceEntryCallback;
66 66
67 // Used to get files from the file system. 67 // Used to get files from the file system.
68 typedef base::Callback<void(FileError error, 68 typedef base::Callback<void(FileError error,
69 const base::FilePath& file_path, 69 const base::FilePath& file_path,
70 scoped_ptr<ResourceEntry> entry)> GetFileCallback; 70 scoped_ptr<ResourceEntry> entry)> GetFileCallback;
71 71
72 // Used to get file content from the file system. 72 // Used to get file content from the file system.
73 // If the file content is available in local cache, |local_file| is filled with 73 // If the file content is available in local cache, |local_file| is filled with
74 // the path to the cache file and |cancel_download_closure| is null. If the file 74 // the path to the cache file. If the file content starts to be downloaded from
75 // content starts to be downloaded from the server, |local_file| is empty and 75 // the server, |local_file| is empty.
76 // |cancel_download_closure| is filled with a closure by calling which the
77 // download job can be cancelled.
78 // |cancel_download_closure| must be called on the UI thread.
79 typedef base::Callback<void(FileError error, 76 typedef base::Callback<void(FileError error,
80 scoped_ptr<ResourceEntry> entry,
81 const base::FilePath& local_file, 77 const base::FilePath& local_file,
82 const base::Closure& cancel_download_closure)> 78 scoped_ptr<ResourceEntry> entry)>
hashimoto 2014/03/27 08:27:48 |entry| and |local_file| are swapped to use the ex
83 GetFileContentInitializedCallback; 79 GetFileContentInitializedCallback;
84 80
85 // Used to get list of entries under a directory. 81 // Used to get list of entries under a directory.
86 // If |error| is not FILE_ERROR_OK, |entries| is null. 82 // If |error| is not FILE_ERROR_OK, |entries| is null.
87 typedef base::Callback<void(FileError error, 83 typedef base::Callback<void(FileError error,
88 scoped_ptr<ResourceEntryVector> entries, 84 scoped_ptr<ResourceEntryVector> entries,
89 bool has_more)> 85 bool has_more)>
90 ReadDirectoryCallback; 86 ReadDirectoryCallback;
91 87
92 // Used to get drive content search results. 88 // Used to get drive content search results.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 325
330 // Makes sure that |file_path| in the file system is available in the local 326 // Makes sure that |file_path| in the file system is available in the local
331 // cache, and mark it as dirty. The next modification to the cache file is 327 // cache, and mark it as dirty. The next modification to the cache file is
332 // watched and is automatically uploaded to the server. If the entry is not 328 // watched and is automatically uploaded to the server. If the entry is not
333 // present in the file system, it is created. 329 // present in the file system, it is created.
334 // 330 //
335 // Returns the cache path and entry info to |callback|. It must not be null. 331 // Returns the cache path and entry info to |callback|. It must not be null.
336 virtual void GetFileForSaving(const base::FilePath& file_path, 332 virtual void GetFileForSaving(const base::FilePath& file_path,
337 const GetFileCallback& callback) = 0; 333 const GetFileCallback& callback) = 0;
338 334
339 // Gets a file by the given |file_path|. 335 // Gets a file by the given |file_path| and returns a closure to cancel the
336 // task.
340 // Calls |initialized_callback| when either: 337 // Calls |initialized_callback| when either:
341 // 1) The cached file (or JSON file for hosted file) is found, or 338 // 1) The cached file (or JSON file for hosted file) is found, or
342 // 2) Starting to download the file from drive server. 339 // 2) Starting to download the file from drive server.
343 // In case of 2), the given FilePath is empty, and |get_content_callback| is 340 // In case of 2), the given FilePath is empty, and |get_content_callback| is
344 // called repeatedly with downloaded content following the 341 // called repeatedly with downloaded content following the
345 // |initialized_callback| invocation. 342 // |initialized_callback| invocation.
346 // |completion_callback| is invoked if an error is found, or the operation 343 // |completion_callback| is invoked if an error is found, or the operation
347 // is successfully done. 344 // is successfully done.
348 // |initialized_callback|, |get_content_callback| and |completion_callback| 345 // |initialized_callback|, |get_content_callback| and |completion_callback|
349 // must not be null. 346 // must not be null.
350 virtual void GetFileContent( 347 virtual base::Closure GetFileContent(
351 const base::FilePath& file_path, 348 const base::FilePath& file_path,
352 const GetFileContentInitializedCallback& initialized_callback, 349 const GetFileContentInitializedCallback& initialized_callback,
353 const google_apis::GetContentCallback& get_content_callback, 350 const google_apis::GetContentCallback& get_content_callback,
354 const FileOperationCallback& completion_callback) = 0; 351 const FileOperationCallback& completion_callback) = 0;
355 352
356 // Finds an entry (a file or a directory) by |file_path|. This call will also 353 // Finds an entry (a file or a directory) by |file_path|. This call will also
357 // retrieve and refresh file system content from server and disk cache. 354 // retrieve and refresh file system content from server and disk cache.
358 // 355 //
359 // |callback| must not be null. 356 // |callback| must not be null.
360 virtual void GetResourceEntry(const base::FilePath& file_path, 357 virtual void GetResourceEntry(const base::FilePath& file_path,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 virtual void Reset(const FileOperationCallback& callback) = 0; 435 virtual void Reset(const FileOperationCallback& callback) = 0;
439 436
440 // Finds a path of an entry (a file or a directory) by |resource_id|. 437 // Finds a path of an entry (a file or a directory) by |resource_id|.
441 virtual void GetPathFromResourceId(const std::string& resource_id, 438 virtual void GetPathFromResourceId(const std::string& resource_id,
442 const GetFilePathCallback& callback) = 0; 439 const GetFilePathCallback& callback) = 0;
443 }; 440 };
444 441
445 } // namespace drive 442 } // namespace drive
446 443
447 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ 444 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698