| Index: chrome/browser/chromeos/drive/file_system.cc
|
| diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
|
| index ffb44ee8c07c3cb863e619f163b6924bd3f359bd..8743b4b302c201dc94db70f69cddcab2827c0b0c 100644
|
| --- a/chrome/browser/chromeos/drive/file_system.cc
|
| +++ b/chrome/browser/chromeos/drive/file_system.cc
|
| @@ -717,6 +717,11 @@ void FileSystem::OnDirectoryChangedByOperation(
|
| OnDirectoryChanged(directory_path);
|
| }
|
|
|
| +void FileSystem::OnCacheFileUploadNeededByOperation(
|
| + const std::string& resource_id) {
|
| + sync_client_->AddUploadTask(resource_id);
|
| +}
|
| +
|
| void FileSystem::OnDirectoryChanged(const base::FilePath& directory_path) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -958,10 +963,7 @@ void FileSystem::CloseFile(const base::FilePath& file_path,
|
| base::Bind(&FileSystem::CloseFileAfterGetResourceEntry,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| file_path,
|
| - base::Bind(&FileSystem::CloseFileFinalize,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - file_path,
|
| - callback)));
|
| + callback));
|
| }
|
|
|
| void FileSystem::CloseFileAfterGetResourceEntry(
|
| @@ -975,27 +977,12 @@ void FileSystem::CloseFileAfterGetResourceEntry(
|
| if (entry.get() && !entry->has_file_specific_info())
|
| error = FILE_ERROR_NOT_FOUND;
|
|
|
| - if (error != FILE_ERROR_OK) {
|
| - callback.Run(error);
|
| - return;
|
| - }
|
| -
|
| - // Step 2 of CloseFile: Commit the modification in cache. This will trigger
|
| - // background upload.
|
| - // TODO(benchan,kinaba): Call ClearDirtyInCache instead of CommitDirtyInCache
|
| - // if the file has not been modified. Come up with a way to detect the
|
| - // intactness effectively, or provide a method for user to declare it when
|
| - // calling CloseFile().
|
| - cache_->CommitDirtyOnUIThread(entry->resource_id(),
|
| - entry->file_specific_info().md5(),
|
| - callback);
|
| -}
|
| -
|
| -void FileSystem::CloseFileFinalize(const base::FilePath& file_path,
|
| - const FileOperationCallback& callback,
|
| - FileError result) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - DCHECK(!callback.is_null());
|
| + // Step 2 of CloseFile: Trigger upload.
|
| + // TODO(benchan,kinaba): Call ClearDirtyInCache if the file has not been
|
| + // modified. Come up with a way to detect the intactness effectively, or
|
| + // provide a method for user to declare it when calling CloseFile().
|
| + if (error == FILE_ERROR_OK)
|
| + sync_client_->AddUploadTask(entry->resource_id());
|
|
|
| // Step 3 of CloseFile.
|
| // All the invocation of |callback| from operations initiated from CloseFile
|
| @@ -1004,7 +991,7 @@ void FileSystem::CloseFileFinalize(const base::FilePath& file_path,
|
| open_files_.erase(file_path);
|
|
|
| // Then invokes the user-supplied callback function.
|
| - callback.Run(result);
|
| + callback.Run(error);
|
| }
|
|
|
| void FileSystem::CheckLocalModificationAndRun(
|
|
|