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

Unified Diff: chrome/browser/extensions/api/file_handlers/app_file_handler_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
Index: chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc
diff --git a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc
index d8e3480fe2405ae7c58514167792f499394b8578..3fa01da54fa3be9abc52d83d41378424015fe2c7 100644
--- a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc
+++ b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc
@@ -124,6 +124,8 @@ class WritableFileChecker
void CheckRemoteWritableFile(const base::FilePath& remote_path,
drive::FileError error,
const base::FilePath& local_path);
+ void RemoteCheckDone(const base::FilePath& remote_path,
+ drive::FileError error);
#endif
const std::vector<base::FilePath> paths_;
@@ -156,10 +158,18 @@ void WritableFileChecker::Check() {
it != paths_.end();
++it) {
DCHECK(drive::util::IsUnderDriveMountPoint(*it));
- drive::util::PrepareWritableFileAndRun(
- profile_,
- *it,
- base::Bind(&WritableFileChecker::CheckRemoteWritableFile, this, *it));
+ if (is_directory_) {
+ drive::util::CheckDirectoryExists(
+ profile_,
+ *it,
+ base::Bind(&WritableFileChecker::RemoteCheckDone, this, *it));
+ } else {
+ drive::util::PrepareWritableFileAndRun(
+ profile_,
+ *it,
+ base::Bind(&WritableFileChecker::CheckRemoteWritableFile, this,
+ *it));
+ }
}
return;
}
@@ -215,6 +225,12 @@ void WritableFileChecker::CheckRemoteWritableFile(
const base::FilePath& remote_path,
drive::FileError error,
const base::FilePath& /* local_path */) {
+ RemoteCheckDone(remote_path, error);
+}
+
+void WritableFileChecker::RemoteCheckDone(
+ const base::FilePath& remote_path,
+ drive::FileError error) {
if (error == drive::FILE_ERROR_OK) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
« no previous file with comments | « chrome/browser/drive/fake_drive_service_unittest.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698