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

Unified Diff: storage/browser/fileapi/sandbox_file_system_backend_delegate.cc

Issue 671873004: Migrates legacy packaged app data when it's upgraded to a platform app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: trybot complaints Created 5 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 | « storage/browser/fileapi/sandbox_file_system_backend_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
index 9fb6b0edb56d2f9e3e9ef50392059a80ea8ea07e..7650e0c5dec9469006ebcdc207c1647c5b93e6cb 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
+++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
@@ -648,6 +648,34 @@ void SandboxFileSystemBackendDelegate::CollectOpenFileSystemMetrics(
#undef REPORT
}
+void SandboxFileSystemBackendDelegate::CopyFileSystem(
+ const GURL& origin_url,
+ FileSystemType type,
+ SandboxFileSystemBackendDelegate* destination) {
+ DCHECK(file_task_runner()->RunsTasksOnCurrentThread());
+
+ base::FilePath base_path =
+ GetBaseDirectoryForOriginAndType(origin_url, type, false /* create */);
+ if (base::PathExists(base_path)) {
+ // Delete any existing file system directories in the destination. A
+ // previously failed migration
+ // may have left behind partially copied directories.
+ base::FilePath dest_path = destination->GetBaseDirectoryForOriginAndType(
+ origin_url, type, false /* create */);
+
+ // Make sure we're not about to delete our own file system.
+ CHECK_NE(base_path.value(), dest_path.value());
+ base::DeleteFile(dest_path, true);
+
+ dest_path = destination->GetBaseDirectoryForOriginAndType(
+ origin_url, type, true /* create */);
+
+ obfuscated_file_util()->CloseFileSystemForOriginAndType(
+ origin_url, GetTypeString(type));
+ base::CopyDirectory(base_path, dest_path.DirName(), true /* rescursive */);
+ }
+}
+
ObfuscatedFileUtil* SandboxFileSystemBackendDelegate::obfuscated_file_util() {
return static_cast<ObfuscatedFileUtil*>(sync_file_util());
}
« no previous file with comments | « storage/browser/fileapi/sandbox_file_system_backend_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698