| 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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 9 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, | 316 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, |
| 317 weak_ptr_factory_.GetWeakPtr(), | 317 weak_ptr_factory_.GetWeakPtr(), |
| 318 context, | 318 context, |
| 319 callback, | 319 callback, |
| 320 local_state->entry.local_id(), | 320 local_state->entry.local_id(), |
| 321 base::Passed(&loader_lock))); | 321 base::Passed(&loader_lock))); |
| 322 return; | 322 return; |
| 323 } | 323 } |
| 324 | 324 |
| 325 // No need to perform update. | 325 // No need to perform update. |
| 326 if (local_state->entry.metadata_edit_state() == ResourceEntry::CLEAN) { | 326 if (local_state->entry.metadata_edit_state() == ResourceEntry::CLEAN || |
| 327 local_state->entry.resource_id().empty()) { |
| 327 callback.Run(FILE_ERROR_OK); | 328 callback.Run(FILE_ERROR_OK); |
| 328 return; | 329 return; |
| 329 } | 330 } |
| 330 | 331 |
| 331 DCHECK(!local_state->entry.resource_id().empty()); | |
| 332 | |
| 333 // Perform metadata update. | 332 // Perform metadata update. |
| 334 scheduler_->UpdateResource( | 333 scheduler_->UpdateResource( |
| 335 local_state->entry.resource_id(), local_state->parent_entry.resource_id(), | 334 local_state->entry.resource_id(), local_state->parent_entry.resource_id(), |
| 336 local_state->entry.title(), last_modified, last_accessed, | 335 local_state->entry.title(), last_modified, last_accessed, |
| 337 context, | 336 context, |
| 338 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, | 337 base::Bind(&EntryUpdatePerformer::UpdateEntryAfterUpdateResource, |
| 339 weak_ptr_factory_.GetWeakPtr(), | 338 weak_ptr_factory_.GetWeakPtr(), |
| 340 context, callback, local_state->entry.local_id(), | 339 context, callback, local_state->entry.local_id(), |
| 341 base::Passed(scoped_ptr<base::ScopedClosureRunner>()))); | 340 base::Passed(scoped_ptr<base::ScopedClosureRunner>()))); |
| 342 } | 341 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 383 DCHECK(!callback.is_null()); | 382 DCHECK(!callback.is_null()); |
| 384 | 383 |
| 385 if (!changed_directory->empty()) | 384 if (!changed_directory->empty()) |
| 386 observer_->OnDirectoryChangedByOperation(*changed_directory); | 385 observer_->OnDirectoryChangedByOperation(*changed_directory); |
| 387 callback.Run(error); | 386 callback.Run(error); |
| 388 } | 387 } |
| 389 | 388 |
| 390 } // namespace internal | 389 } // namespace internal |
| 391 } // namespace drive | 390 } // namespace drive |
| OLD | NEW |