| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/drive/sync/entry_update_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/entry_update_performer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 8 #include "chrome/browser/chromeos/drive/file_system_util.h" | 8 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 9 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 9 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 10 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 10 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (entry->parent_local_id() == util::kDriveTrashDirLocalId) { | 132 if (entry->parent_local_id() == util::kDriveTrashDirLocalId) { |
| 133 remove_performer_->Remove(entry->local_id(), callback); | 133 remove_performer_->Remove(entry->local_id(), callback); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (entry->metadata_edit_state() == ResourceEntry::CLEAN) { | 137 if (entry->metadata_edit_state() == ResourceEntry::CLEAN) { |
| 138 callback.Run(FILE_ERROR_OK); | 138 callback.Run(FILE_ERROR_OK); |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 | 141 |
| 142 std::string parent_resource_id; | |
| 143 if (!util::IsSpecialResourceId(parent_entry->resource_id())) | |
| 144 parent_resource_id = parent_entry->resource_id(); | |
| 145 | |
| 146 base::Time last_modified = | 142 base::Time last_modified = |
| 147 base::Time::FromInternalValue(entry->file_info().last_modified()); | 143 base::Time::FromInternalValue(entry->file_info().last_modified()); |
| 148 base::Time last_accessed = | 144 base::Time last_accessed = |
| 149 base::Time::FromInternalValue(entry->file_info().last_accessed()); | 145 base::Time::FromInternalValue(entry->file_info().last_accessed()); |
| 150 scheduler_->UpdateResource( | 146 scheduler_->UpdateResource( |
| 151 entry->resource_id(), parent_resource_id, | 147 entry->resource_id(), parent_entry->resource_id(), |
| 152 entry->title(), last_modified, last_accessed, | 148 entry->title(), last_modified, last_accessed, |
| 153 ClientContext(BACKGROUND), | 149 ClientContext(BACKGROUND), |
| 154 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, | 150 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, |
| 155 weak_ptr_factory_.GetWeakPtr(), callback, entry->local_id())); | 151 weak_ptr_factory_.GetWeakPtr(), callback, entry->local_id())); |
| 156 } | 152 } |
| 157 | 153 |
| 158 void EntryUpdatePerformer::UpdateEntryAfterUpdateResource( | 154 void EntryUpdatePerformer::UpdateEntryAfterUpdateResource( |
| 159 const FileOperationCallback& callback, | 155 const FileOperationCallback& callback, |
| 160 const std::string& local_id, | 156 const std::string& local_id, |
| 161 google_apis::GDataErrorCode status, | 157 google_apis::GDataErrorCode status, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 176 | 172 |
| 177 base::PostTaskAndReplyWithResult( | 173 base::PostTaskAndReplyWithResult( |
| 178 blocking_task_runner_.get(), | 174 blocking_task_runner_.get(), |
| 179 FROM_HERE, | 175 FROM_HERE, |
| 180 base::Bind(&FinishUpdate, metadata_, local_id), | 176 base::Bind(&FinishUpdate, metadata_, local_id), |
| 181 callback); | 177 callback); |
| 182 } | 178 } |
| 183 | 179 |
| 184 } // namespace internal | 180 } // namespace internal |
| 185 } // namespace drive | 181 } // namespace drive |
| OLD | NEW |