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

Unified Diff: components/drive/chromeos/change_list_processor.cc

Issue 2799603002: Process TeamDrive change in change list. (Closed)
Patch Set: Remove unnecessary return value, as the TeamDriveResource conversion always succeeds. Created 3 years, 8 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
« no previous file with comments | « components/drive/chromeos/change_list_processor.h ('k') | components/drive/file_system_core_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/drive/chromeos/change_list_processor.cc
diff --git a/components/drive/chromeos/change_list_processor.cc b/components/drive/chromeos/change_list_processor.cc
index 3eb96bb1c81a47f9d7de103166f40b752d7b951f..6bee2badaea7e40f7f44b270b042fefe47a6c5a5 100644
--- a/components/drive/chromeos/change_list_processor.cc
+++ b/components/drive/chromeos/change_list_processor.cc
@@ -81,8 +81,7 @@ ChangeList::ChangeList(const google_apis::ChangeList& change_list)
size_t entries_index = 0;
for (size_t i = 0; i < items.size(); ++i) {
if (ConvertChangeResourceToResourceEntry(
- *items[i],
- &entries_[entries_index],
+ *items[i], &entries_[entries_index],
&parent_resource_ids_[entries_index])) {
++entries_index;
}
@@ -348,6 +347,7 @@ FileError ChangeListProcessor::ApplyEntryMap(
FileError ChangeListProcessor::ApplyEntry(const ResourceEntry& entry) {
DCHECK(!entry.deleted());
+ DCHECK(!entry.resource_id().empty());
DCHECK(parent_resource_id_map_.count(entry.resource_id()));
const std::string& parent_resource_id =
parent_resource_id_map_[entry.resource_id()];
@@ -465,6 +465,11 @@ FileError ChangeListProcessor::SetParentLocalIdOfEntry(
ResourceMetadata* resource_metadata,
ResourceEntry* entry,
const std::string& parent_resource_id) {
+ if (entry->parent_local_id() == util::kDriveTeamDrivesDirLocalId) {
+ // When |entry| is a root directory of a Team Drive, the parent directory
+ // of it is "/team_drives", which doesn't have resource ID.
+ return FILE_ERROR_OK;
+ }
std::string parent_local_id;
if (parent_resource_id.empty()) {
// Entries without parents should go under "other" directory.
« no previous file with comments | « components/drive/chromeos/change_list_processor.h ('k') | components/drive/file_system_core_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698