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

Unified Diff: content/browser/indexed_db/indexed_db_context_impl.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: Rebase Created 6 years 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: content/browser/indexed_db/indexed_db_context_impl.cc
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc
index c7e13263677bc3aa093aa0d7ff52426d861b3c78..e3f650e67b969c2ef4340f3f00cd4ecbc7674638 100644
--- a/content/browser/indexed_db/indexed_db_context_impl.cc
+++ b/content/browser/indexed_db/indexed_db_context_impl.cc
@@ -322,6 +322,29 @@ void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) {
}
}
+void IndexedDBContextImpl::CopyOriginData(const GURL& origin_url,
+ IndexedDBContext* dest_context) {
+ DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
+ ForceClose(origin_url, FORCE_CLOSE_COPY_ORIGIN);
+ if (data_path_.empty() || !IsInOriginSet(origin_url))
+ return;
+
+ base::FilePath idb_directory =
+ GetFilePathForTesting(origin_url.possibly_invalid_spec());
jsbell 2014/12/12 17:46:09 The "ForTesting" methods should only be called fro
+ base::FilePath dest_directory =
jsbell 2014/12/12 17:46:09 This is basically just computing <context>/Indexed
ryanackley 2014/12/12 19:03:04 Should I expose the methods I need on IndexedDBCon
+ dest_context->GetFilePathForTesting(origin_url.possibly_invalid_spec());
+
+ if (base::PathExists(dest_directory)) {
+ return;
+ }
+
+ if (!base::PathExists(dest_directory.DirName())) {
+ base::CreateDirectory(dest_directory.DirName());
+ }
+
+ base::CopyDirectory(idb_directory, dest_directory.DirName(), true);
+}
+
void IndexedDBContextImpl::ForceClose(const GURL origin_url,
ForceCloseReason reason) {
DCHECK(TaskRunner()->RunsTasksOnCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698