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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10790126: gdata: Remove use of GetGDataEntryByPath() from Rename (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_file_system.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index bf441df31f4bad2b6249e5036a95cb525e178ff4..b4e1206d0bbedebf59524c9caeb93dae4ad69bd9 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -1468,28 +1468,46 @@ void GDataFileSystem::Rename(const FilePath& file_path,
return;
}
- GDataEntry* entry = GetGDataEntryByPath(file_path);
- if (!entry) {
- if (!callback.is_null()) {
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND, file_path));
- }
+ // Get the edit URL of an entry at |file_path|.
+ GetEntryInfoByPath(file_path,
+ base::Bind(
+ &GDataFileSystem::RenameAfterGetEntryInfo,
+ ui_weak_ptr_,
+ file_path,
+ new_name,
+ callback));
+}
+
+void GDataFileSystem::RenameAfterGetEntryInfo(
+ const FilePath& file_path,
+ const FilePath::StringType& new_name,
+ const FilePathUpdateCallback& callback,
+ GDataFileError error,
+ scoped_ptr<GDataEntryProto> entry_proto) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (error != GDATA_FILE_OK) {
+ if (!callback.is_null())
+ callback.Run(error, file_path);
return;
}
+ DCHECK(entry_proto.get());
// Drop the .g<something> extension from |new_name| if the file being
// renamed is a hosted document and |new_name| has the same .g<something>
// extension as the file.
FilePath::StringType file_name = new_name;
- if (entry->AsGDataFile() && entry->AsGDataFile()->is_hosted_document()) {
+ if (entry_proto->has_file_specific_info() &&
achuithb 2012/07/23 22:06:00 I know this is not part of this CL, but what happe
satorux1 2012/07/23 22:23:58 Nothing is wrong with entry_proto->has_file_specif
+ entry_proto->file_specific_info().is_hosted_document()) {
FilePath new_file(file_name);
- if (new_file.Extension() == entry->AsGDataFile()->document_extension()) {
+ if (new_file.Extension() ==
+ entry_proto->file_specific_info().document_extension()) {
file_name = new_file.RemoveExtension().value();
}
}
documents_service_->RenameResource(
- entry->edit_url(),
+ GURL(entry_proto->edit_url()),
file_name,
base::Bind(&GDataFileSystem::OnRenameResourceCompleted,
ui_weak_ptr_,
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698