Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7729)

Unified Diff: chrome/browser/chromeos/drive/resource_metadata.cc

Issue 22920004: Reimplement MoveOperation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/resource_metadata.cc
diff --git a/chrome/browser/chromeos/drive/resource_metadata.cc b/chrome/browser/chromeos/drive/resource_metadata.cc
index 0b1b6e9c4c6a45b0caf04f64056ae97fea2be993..e6972bf67fbcbce282a04a2bf3c993a6b5159d4f 100644
--- a/chrome/browser/chromeos/drive/resource_metadata.cc
+++ b/chrome/browser/chromeos/drive/resource_metadata.cc
@@ -447,12 +447,14 @@ FileError ResourceMetadata::RefreshEntry(const ResourceEntry& entry) {
entry.file_info().is_directory())
return FILE_ERROR_INVALID_OPERATION;
- // Update data.
+ // Make sure that the new parent exists and it is a directory.
ResourceEntry new_parent;
- if (!storage_->GetEntry(entry.parent_local_id(), &new_parent) ||
- !new_parent.file_info().is_directory())
+ if (!storage_->GetEntry(entry.parent_local_id(), &new_parent))
return FILE_ERROR_NOT_FOUND;
+ if (!new_parent.file_info().is_directory())
+ return FILE_ERROR_NOT_A_DIRECTORY;
+
// Remove from the old parent and add it to the new parent with the new data.
if (!PutEntryUnderDirectory(entry))
return FILE_ERROR_FAILED;

Powered by Google App Engine
This is Rietveld 408576698