Index: chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc |
diff --git a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc |
index e1964a4efb951d6b0b1ce8dc0a03e0e7f2724ec7..12d33d84b878e838c6e010c37c668adea377fb31 100644 |
--- a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc |
+++ b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc |
@@ -18,21 +18,6 @@ using content::BrowserThread; |
namespace drive { |
namespace file_system { |
-namespace { |
- |
-// Marks the cache entry as dirty. |
-FileError MarkDirty(internal::ResourceMetadata* metadata, |
- internal::FileCache* cache, |
- const std::string& resource_id, |
- std::string* local_id) { |
- FileError error = metadata->GetIdByResourceId(resource_id, local_id); |
- if (error != FILE_ERROR_OK) |
- return error; |
- return cache->MarkDirty(*local_id); |
-} |
- |
-} // namespace |
- |
GetFileForSavingOperation::GetFileForSavingOperation( |
base::SequencedTaskRunner* blocking_task_runner, |
OperationObserver* observer, |
@@ -113,24 +98,23 @@ void GetFileForSavingOperation::GetFileForSavingAfterDownload( |
return; |
} |
- const std::string& resource_id = entry->resource_id(); |
- std::string* local_id = new std::string; |
+ const std::string& local_id = entry->local_id(); |
base::PostTaskAndReplyWithResult( |
blocking_task_runner_.get(), |
FROM_HERE, |
- base::Bind(&MarkDirty, metadata_, cache_, resource_id, local_id), |
+ base::Bind(&internal::FileCache::MarkDirty, |
+ base::Unretained(cache_), |
+ local_id), |
base::Bind(&GetFileForSavingOperation::GetFileForSavingAfterMarkDirty, |
weak_ptr_factory_.GetWeakPtr(), |
callback, |
cache_path, |
- base::Owned(local_id), |
base::Passed(&entry))); |
} |
void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty( |
const GetFileCallback& callback, |
const base::FilePath& cache_path, |
- const std::string* local_id, |
scoped_ptr<ResourceEntry> entry, |
FileError error) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
@@ -141,6 +125,7 @@ void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty( |
return; |
} |
+ const std::string& local_id = entry->local_id(); |
file_write_watcher_->StartWatch( |
cache_path, |
base::Bind(&GetFileForSavingOperation::GetFileForSavingAfterWatch, |
@@ -150,7 +135,7 @@ void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty( |
base::Passed(&entry)), |
base::Bind(&GetFileForSavingOperation::OnWriteEvent, |
weak_ptr_factory_.GetWeakPtr(), |
- *local_id)); |
+ local_id)); |
} |
void GetFileForSavingOperation::GetFileForSavingAfterWatch( |