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 2f2ec2a310aefbd8cf25eca4c00cf7b057b9b96a..fc5a7392cc0f171950dfbb636d3501c5ec8d34f9 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)); |
@@ -956,10 +961,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( |
@@ -973,27 +975,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 |
@@ -1002,7 +989,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( |