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

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

Issue 12585003: drive: Add showroot=true to WAPI feed URLs and ignore "no parent" entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests. Created 7 years, 9 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/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 4fdde564420d372d4dafc37c211e9173c3a885fc..37eca879b3bbdaca9a098132413ce3cc15163870 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(
@@ -461,7 +461,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,14 +481,12 @@ void DriveResourceMetadata::AddEntry(const DriveEntryProto& entry_proto,
base::Bind(callback, DRIVE_FILE_OK, GetFilePath(added_entry->proto())));
}
-DriveDirectory* DriveResourceMetadata::GetParent(
- const std::string& parent_resource_id) {
+DriveDirectory* DriveResourceMetadata::GetDirectory(
+ const std::string& resource_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!resource_id.empty());
- if (parent_resource_id.empty())
- return root_.get();
-
- DriveEntry* entry = GetEntryByResourceId(parent_resource_id);
+ DriveEntry* entry = GetEntryByResourceId(resource_id);
return entry ? entry->AsDriveDirectory() : NULL;
}

Powered by Google App Engine
This is Rietveld 408576698