Index: chrome/browser/chromeos/drive/file_system_util.cc |
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc |
index d5398712a069e0521466fd013f255d9039d4ddf5..46eb9fae50218c5275cfc664fe92b49c358a2087 100644 |
--- a/chrome/browser/chromeos/drive/file_system_util.cc |
+++ b/chrome/browser/chromeos/drive/file_system_util.cc |
@@ -109,6 +109,15 @@ DriveIntegrationService* GetIntegrationServiceByProfile(Profile* profile) { |
return service; |
} |
+void CheckDirectoryExistsAfterGetResourceEntry( |
+ const FileOperationCallback& callback, |
+ FileError error, |
+ scoped_ptr<ResourceEntry> entry) { |
+ if (error == FILE_ERROR_OK && !entry->file_info().is_directory()) |
+ error = FILE_ERROR_NOT_A_DIRECTORY; |
+ callback.Run(error); |
+} |
+ |
} // namespace |
const base::FilePath& GetDriveGrandRootPath() { |
@@ -343,6 +352,20 @@ void EnsureDirectoryExists(Profile* profile, |
} |
} |
+void CheckDirectoryExists(Profile* profile, |
+ const base::FilePath& directory, |
+ const FileOperationCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
+ |
+ FileSystemInterface* file_system = GetFileSystemByProfile(profile); |
+ DCHECK(file_system); |
+ |
+ file_system->GetResourceEntry( |
+ ExtractDrivePath(directory), |
+ base::Bind(&CheckDirectoryExistsAfterGetResourceEntry, callback)); |
+} |
+ |
void EmptyFileOperationCallback(FileError error) { |
} |