Index: chrome/browser/chromeos/drive/file_write_helper.cc |
diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc |
index c48262cd51abdb23171eb0cdc52e30f146cc13ab..b5623edb896502ad314343467945ac244c3e1187 100644 |
--- a/chrome/browser/chromeos/drive/file_write_helper.cc |
+++ b/chrome/browser/chromeos/drive/file_write_helper.cc |
@@ -4,26 +4,16 @@ |
#include "chrome/browser/chromeos/drive/file_write_helper.h" |
+#include "base/bind.h" |
+#include "base/callback.h" |
#include "base/threading/sequenced_worker_pool.h" |
+#include "chrome/browser/chromeos/drive/file_system_interface.h" |
#include "content/public/browser/browser_thread.h" |
using content::BrowserThread; |
namespace drive { |
-namespace { |
- |
-// Emits debug log when FileSystem::CloseFile() is complete. |
-void EmitDebugLogForCloseFile(const base::FilePath& file_path, |
- FileError file_error) { |
- if (file_error != FILE_ERROR_OK) { |
- LOG(WARNING) << "CloseFile failed: " << file_path.AsUTF8Unsafe() << ": " |
- << file_error; |
- } |
-} |
- |
-} // namespace |
- |
FileWriteHelper::FileWriteHelper(FileSystemInterface* file_system) |
: file_system_(file_system), |
weak_ptr_factory_(this) { |
@@ -52,7 +42,8 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( |
const base::FilePath& file_path, |
const OpenFileCallback& callback, |
FileError error, |
- const base::FilePath& local_cache_path) { |
+ const base::FilePath& local_cache_path, |
+ const base::Closure& close_callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!callback.is_null()); |
@@ -66,16 +57,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( |
content::BrowserThread::GetBlockingPool()->PostTaskAndReply( |
FROM_HERE, |
base::Bind(callback, FILE_ERROR_OK, local_cache_path), |
- base::Bind(&FileWriteHelper::PrepareWritableFileAndRunAfterCallback, |
- weak_ptr_factory_.GetWeakPtr(), |
- file_path)); |
-} |
- |
-void FileWriteHelper::PrepareWritableFileAndRunAfterCallback( |
- const base::FilePath& file_path) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- file_system_->CloseFile(file_path, |
- base::Bind(&EmitDebugLogForCloseFile, file_path)); |
+ close_callback); |
} |
} // namespace drive |