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

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

Issue 13456002: drive: Fills no-parent entiries in "/drive/other". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased on 192559 Created 7 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: chrome/browser/chromeos/drive/resource_entry_conversion.cc
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.cc b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
index 30561933fe1f33552316e36af9588645dc3eed1c..038d1b87051d9463cc531405485715d6ece89ad3 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.cc
+++ b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
@@ -52,15 +52,20 @@ DriveEntryProto ConvertResourceEntryToDriveEntryProto(
if (edit_link)
entry_proto.set_edit_url(edit_link->href().spec());
+ // Sets parent Resource ID. On drive.google.com, a file can have multiple
+ // parents or no parent, but we are forcing a tree-shaped structure (i.e. no
+ // multi-parent or zero-parent entries). Therefore the first found "parent" is
+ // used for the entry and if the entry has no parent, we assign a special ID
+ // which represents no-parent entries. Tracked in http://crbug.com/158904.
const google_apis::Link* parent_link =
entry.GetLinkByType(google_apis::Link::LINK_PARENT);
if (parent_link) {
- // TODO(haruki): Apply mapping from an empty parent to special dummy
- // directory. See http://crbug.com/174233. Until we implement it,
- // ChangeListProcessor ignores such "no parent" entries.
entry_proto.set_parent_resource_id(
util::ExtractResourceIdFromUrl(parent_link->href()));
}
+ // Apply mapping from an empty parent to the special dummy directory.
+ if (entry_proto.parent_resource_id().empty())
+ entry_proto.set_parent_resource_id(util::kDriveOtherDirSpecialResourceId);
entry_proto.set_deleted(entry.deleted());
entry_proto.set_shared_with_me(HasSharedWithMeLabel(entry));

Powered by Google App Engine
This is Rietveld 408576698