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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc

Issue 622513002: Create a cache file before mounting zip file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/extensions/file_manager/private_api_mount.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
index a8b4fd1aa2dbb5b9d86136150442a15a39ecdd12..0ab01ef60ac91e86ff10cd5e833251e7f49c4cad 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
@@ -73,11 +73,13 @@ bool FileManagerPrivateAddMountFunction::RunAsync() {
if (!file_system)
return false;
- file_system->MarkCacheFileAsMounted(
- drive::util::ExtractDrivePath(path),
- base::Bind(
- &FileManagerPrivateAddMountFunction::RunAfterMarkCacheFileAsMounted,
- this, path.BaseName()));
+ // Ensure that the cache file exists.
+ const base::FilePath drive_path = drive::util::ExtractDrivePath(path);
+ file_system->GetFile(
+ drive_path,
+ base::Bind(&FileManagerPrivateAddMountFunction::RunAfterGetDriveFile,
+ this,
+ drive_path));
} else {
file_manager::VolumeManager* volume_manager =
file_manager::VolumeManager::Get(GetProfile());
@@ -114,6 +116,33 @@ bool FileManagerPrivateAddMountFunction::RunAsync() {
return true;
}
+void FileManagerPrivateAddMountFunction::RunAfterGetDriveFile(
+ const base::FilePath& drive_path,
+ drive::FileError error,
+ const base::FilePath& cache_path,
+ scoped_ptr<drive::ResourceEntry> entry) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ if (error != drive::FILE_ERROR_OK) {
+ SendResponse(false);
+ return;
+ }
+
+ drive::FileSystemInterface* const file_system =
+ drive::util::GetFileSystemByProfile(GetProfile());
+ if (!file_system) {
+ SendResponse(false);
+ return;
+ }
+
+ file_system->MarkCacheFileAsMounted(
+ drive_path,
+ base::Bind(
+ &FileManagerPrivateAddMountFunction::RunAfterMarkCacheFileAsMounted,
+ this,
+ drive_path.BaseName()));
+}
+
void FileManagerPrivateAddMountFunction::RunAfterMarkCacheFileAsMounted(
const base::FilePath& display_name,
drive::FileError error,
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_mount.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698