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

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

Issue 2799603002: Process TeamDrive change in change list. (Closed)
Patch Set: Handle changes to Team Drive by the same path as files, including deletion. 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
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..5ce4221ef009a62721d0e3a85eca2543e6f9fb6e 100644
--- a/components/drive/chromeos/change_list_processor.cc
+++ b/components/drive/chromeos/change_list_processor.cc
@@ -20,6 +20,7 @@
#include "components/drive/file_system_core_util.h"
#include "components/drive/resource_entry_conversion.h"
#include "google_apis/drive/drive_api_parser.h"
+#include "google_apis/drive/drive_switches.h"
hashimoto 2017/04/10 11:01:24 No longer needed.
yamaguchi 2017/04/11 07:08:07 Done.
namespace drive {
namespace internal {
@@ -81,8 +82,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;
}
@@ -308,6 +308,8 @@ FileError ChangeListProcessor::ApplyEntryMap(
for (size_t i = 0; i < entries.size(); ++i) {
// Skip root entry in the change list. We don't expect servers to send
// root entry, but we should better be defensive (see crbug.com/297259).
+ // TODO(yamaguchi): Apply this defensive logic to root directories of
hashimoto 2017/04/10 11:01:24 Why do you need to do this?
yamaguchi 2017/04/11 07:08:07 According to crbug.com/297259, the root directory
hashimoto 2017/04/11 07:55:14 We are doing this for My Drive root because the sa
+ // every Team Drive as well.
ResourceEntryMap::iterator it = entries[i];
if (it->first != root.resource_id()) {
FileError error = ApplyEntry(it->second);
@@ -348,6 +350,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()];

Powered by Google App Engine
This is Rietveld 408576698