Index: chrome/browser/chromeos/gdata/drive_file_system.cc |
diff --git a/chrome/browser/chromeos/gdata/drive_file_system.cc b/chrome/browser/chromeos/gdata/drive_file_system.cc |
index b159ba5be844f176c25920be18aa4bcd7c7cf6b3..9ea2da6b3a7add085607573bd313d58da03111a4 100644 |
--- a/chrome/browser/chromeos/gdata/drive_file_system.cc |
+++ b/chrome/browser/chromeos/gdata/drive_file_system.cc |
@@ -1227,6 +1227,8 @@ void DriveFileSystem::Remove(const FilePath& file_path, |
const FileOperationCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ DCHECK(!callback.is_null()); |
+ |
RunTaskOnUIThread(base::Bind(&DriveFileSystem::RemoveOnUIThread, |
ui_weak_ptr_, |
file_path, |
@@ -1237,6 +1239,7 @@ void DriveFileSystem::RemoveOnUIThread( |
const FilePath& file_path, |
const FileOperationCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
// Get the edit URL of an entry at |file_path|. |
resource_metadata_->GetEntryInfoByPath( |
@@ -1252,16 +1255,20 @@ void DriveFileSystem::RemoveOnUIThreadAfterGetEntryInfo( |
DriveFileError error, |
scoped_ptr<DriveEntryProto> entry_proto) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
if (error != DRIVE_FILE_OK) { |
- if (!callback.is_null()) { |
- base::MessageLoopProxy::current()->PostTask( |
- FROM_HERE, base::Bind(callback, error)); |
- } |
+ callback.Run(error); |
return; |
} |
- |
DCHECK(entry_proto.get()); |
+ |
+ // The edit URL can be empty for some reason. |
+ if (entry_proto->edit_url().empty()) { |
+ callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); |
+ return; |
+ } |
+ |
drive_service_->DeleteDocument( |
GURL(entry_proto->edit_url()), |
base::Bind(&DriveFileSystem::RemoveResourceLocally, |
@@ -2439,11 +2446,11 @@ void DriveFileSystem::RemoveResourceLocally( |
GDataErrorCode status, |
const GURL& /* document_url */) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
DriveFileError error = util::GDataToDriveFileError(status); |
if (error != DRIVE_FILE_OK) { |
- if (!callback.is_null()) |
- callback.Run(error); |
+ callback.Run(error); |
return; |
} |