| Index: chrome/browser/chromeos/drive/file_system/touch_operation.cc
|
| diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation.cc b/chrome/browser/chromeos/drive/file_system/touch_operation.cc
|
| index bb1b23dde33d75581647c5c7448649206b722648..e05df96f85cc4df84dea877d2e51cc270ee2fe7e 100644
|
| --- a/chrome/browser/chromeos/drive/file_system/touch_operation.cc
|
| +++ b/chrome/browser/chromeos/drive/file_system/touch_operation.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/files/file_path.h"
|
| #include "base/sequenced_task_runner.h"
|
| #include "base/time/time.h"
|
| +#include "chrome/browser/chromeos/drive/file_change.h"
|
| #include "chrome/browser/chromeos/drive/file_errors.h"
|
| #include "chrome/browser/chromeos/drive/file_system/operation_observer.h"
|
| #include "chrome/browser/chromeos/drive/resource_metadata.h"
|
| @@ -25,21 +26,22 @@ FileError UpdateLocalState(internal::ResourceMetadata* metadata,
|
| const base::FilePath& file_path,
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time,
|
| - std::string* local_id) {
|
| - ResourceEntry entry;
|
| - FileError error = metadata->GetResourceEntryByPath(file_path, &entry);
|
| + ResourceEntry* entry,
|
| + std::string* local_id) {
|
| +
|
| + FileError error = metadata->GetResourceEntryByPath(file_path, entry);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| - *local_id = entry.local_id();
|
| + *local_id = entry->local_id();
|
|
|
| - PlatformFileInfoProto* file_info = entry.mutable_file_info();
|
| + PlatformFileInfoProto* file_info = entry->mutable_file_info();
|
| if (!last_access_time.is_null())
|
| file_info->set_last_accessed(last_access_time.ToInternalValue());
|
| if (!last_modified_time.is_null())
|
| file_info->set_last_modified(last_modified_time.ToInternalValue());
|
| - entry.set_metadata_edit_state(ResourceEntry::DIRTY);
|
| - entry.set_modification_date(base::Time::Now().ToInternalValue());
|
| - return metadata->RefreshEntry(entry);
|
| + entry->set_metadata_edit_state(ResourceEntry::DIRTY);
|
| + entry->set_modification_date(base::Time::Now().ToInternalValue());
|
| + return metadata->RefreshEntry(*entry);
|
| }
|
|
|
| } // namespace
|
| @@ -64,6 +66,7 @@ void TouchOperation::TouchFile(const base::FilePath& file_path,
|
| DCHECK(!callback.is_null());
|
|
|
| std::string* local_id = new std::string;
|
| + ResourceEntry* entry = new ResourceEntry;
|
| base::PostTaskAndReplyWithResult(
|
| blocking_task_runner_.get(),
|
| FROM_HERE,
|
| @@ -72,24 +75,32 @@ void TouchOperation::TouchFile(const base::FilePath& file_path,
|
| file_path,
|
| last_access_time,
|
| last_modified_time,
|
| + entry,
|
| local_id),
|
| base::Bind(&TouchOperation::TouchFileAfterUpdateLocalState,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| file_path,
|
| callback,
|
| + base::Owned(entry),
|
| base::Owned(local_id)));
|
| }
|
|
|
| void TouchOperation::TouchFileAfterUpdateLocalState(
|
| const base::FilePath& file_path,
|
| const FileOperationCallback& callback,
|
| + const ResourceEntry* entry,
|
| const std::string* local_id,
|
| FileError error) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!callback.is_null());
|
| + DCHECK(!entry->file_info().is_directory());
|
| +
|
| + FileChange changed_files;
|
| + changed_files.Update(
|
| + file_path, FileChange::FILE_TYPE_FILE, FileChange::ADD_OR_UPDATE);
|
|
|
| if (error == FILE_ERROR_OK) {
|
| - observer_->OnDirectoryChangedByOperation(file_path.DirName());
|
| + observer_->OnFileChangedByOperation(changed_files);
|
| observer_->OnEntryUpdatedByOperation(*local_id);
|
| }
|
| callback.Run(error);
|
|
|