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

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

Issue 137343008: Make chrome.fileSystem.chooseEntry work on Google Drive directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Created 6 years, 11 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/drive/file_system_util.h ('k') | chrome/browser/drive/fake_drive_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
}
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.h ('k') | chrome/browser/drive/fake_drive_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698