Chromium Code Reviews| 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..d6c0fa5bee8598ce1f6f9e4c8adf4d89a644fae3 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,18 +1255,22 @@ 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()), |
| + GURL(), |
|
achuithb
2012/08/27 21:13:36
What's this?
satorux1
2012/08/27 22:07:23
Cannot believe I left this, but this was to test i
|
| base::Bind(&DriveFileSystem::RemoveResourceLocally, |
| ui_weak_ptr_, |
| callback, |
| @@ -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; |
| } |