Chromium Code Reviews| Index: chrome/browser/chromeos/drive/drive_resource_metadata.cc |
| diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc |
| index 43d0bbfc2f19c37b9bf90beeeb747c0641ca0fb8..06e156e133647d8cc6d588744600ace191bf4032 100644 |
| --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc |
| +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc |
| @@ -388,8 +388,8 @@ void DriveResourceMetadata::RefreshEntry( |
| // Update data. |
| if (entry != root_.get()) { |
| - DriveDirectory* old_parent = GetParent(entry->parent_resource_id()); |
| - DriveDirectory* new_parent = GetParent(entry_proto.parent_resource_id()); |
| + DriveDirectory* old_parent = GetDirectory(entry->parent_resource_id()); |
| + DriveDirectory* new_parent = GetDirectory(entry_proto.parent_resource_id()); |
| if (!old_parent || !new_parent) { |
| PostGetEntryInfoWithFilePathCallbackError( |
| @@ -399,6 +399,9 @@ void DriveResourceMetadata::RefreshEntry( |
| // Remove from the old parent and add to the new parent. |
| old_parent->RemoveChild(entry); |
| + // FromProto(entry_proto) imports the fields from |entry_proto|. Note that |
| + // this assumes |entry_proto| contains metadata only about the entry itself. |
|
hashimoto
2013/03/12 07:55:17
This comment seems to be redundant.
Only DriveDire
Haruki Sato
2013/03/12 08:17:23
Thank you for the good explanation. Seemsl like I
|
| + // i.e. no children protos included. |
| entry->FromProto(entry_proto); |
| new_parent->AddEntry(entry); // Transfers ownership. |
| } else { |
| @@ -461,7 +464,7 @@ void DriveResourceMetadata::AddEntry(const DriveEntryProto& entry_proto, |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| DCHECK(!callback.is_null()); |
| - DriveDirectory* parent = GetParent(entry_proto.parent_resource_id()); |
| + DriveDirectory* parent = GetDirectory(entry_proto.parent_resource_id()); |
| if (!parent) { |
| PostFileMoveCallbackError(callback, DRIVE_FILE_ERROR_NOT_FOUND); |
| return; |
| @@ -481,12 +484,10 @@ void DriveResourceMetadata::AddEntry(const DriveEntryProto& entry_proto, |
| base::Bind(callback, DRIVE_FILE_OK, GetFilePath(added_entry->proto()))); |
| } |
| -DriveDirectory* DriveResourceMetadata::GetParent( |
| +DriveDirectory* DriveResourceMetadata::GetDirectory( |
| const std::string& parent_resource_id) { |
|
hashimoto
2013/03/12 07:55:17
nit: s/parent_resource_id/resource_id/?
Haruki Sato
2013/03/12 08:17:23
Done. Thanks.
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - |
| - if (parent_resource_id.empty()) |
| - return root_.get(); |
| + DCHECK(!parent_resource_id.empty()); |
| DriveEntry* entry = GetEntryByResourceId(parent_resource_id); |
| return entry ? entry->AsDriveDirectory() : NULL; |