OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/app_data_migrator.h" | 5 #include "chrome/browser/extensions/app_data_migrator.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 using content::StoragePartition; | 24 using content::StoragePartition; |
25 using storage::FileSystemContext; | 25 using storage::FileSystemContext; |
26 using storage::SandboxFileSystemBackendDelegate; | 26 using storage::SandboxFileSystemBackendDelegate; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 void MigrateOnFileSystemThread(FileSystemContext* old_fs_context, | 30 void MigrateOnFileSystemThread(FileSystemContext* old_fs_context, |
31 FileSystemContext* fs_context, | 31 FileSystemContext* fs_context, |
32 const extensions::Extension* extension) { | 32 const extensions::Extension* extension) { |
33 DCHECK( | 33 DCHECK( |
34 old_fs_context->default_file_task_runner()->RunsTasksOnCurrentThread()); | 34 old_fs_context->default_file_task_runner()->RunsTasksInCurrentSequence()); |
35 | 35 |
36 SandboxFileSystemBackendDelegate* old_sandbox_delegate = | 36 SandboxFileSystemBackendDelegate* old_sandbox_delegate = |
37 old_fs_context->sandbox_delegate(); | 37 old_fs_context->sandbox_delegate(); |
38 SandboxFileSystemBackendDelegate* sandbox_delegate = | 38 SandboxFileSystemBackendDelegate* sandbox_delegate = |
39 fs_context->sandbox_delegate(); | 39 fs_context->sandbox_delegate(); |
40 | 40 |
41 GURL extension_url = | 41 GURL extension_url = |
42 extensions::Extension::GetBaseURLFromExtensionId(extension->id()); | 42 extensions::Extension::GetBaseURLFromExtensionId(extension->id()); |
43 | 43 |
44 std::unique_ptr<storage::SandboxFileSystemBackendDelegate::OriginEnumerator> | 44 std::unique_ptr<storage::SandboxFileSystemBackendDelegate::OriginEnumerator> |
(...skipping 15 matching lines...) Expand all Loading... |
60 if (enumerator->HasFileSystemType(storage::kFileSystemTypePersistent)) { | 60 if (enumerator->HasFileSystemType(storage::kFileSystemTypePersistent)) { |
61 old_sandbox_delegate->CopyFileSystem( | 61 old_sandbox_delegate->CopyFileSystem( |
62 extension_url, storage::kFileSystemTypePersistent, sandbox_delegate); | 62 extension_url, storage::kFileSystemTypePersistent, sandbox_delegate); |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void MigrateOnIndexedDBThread(IndexedDBContext* old_indexed_db_context, | 67 void MigrateOnIndexedDBThread(IndexedDBContext* old_indexed_db_context, |
68 IndexedDBContext* indexed_db_context, | 68 IndexedDBContext* indexed_db_context, |
69 const extensions::Extension* extension) { | 69 const extensions::Extension* extension) { |
70 DCHECK(old_indexed_db_context->TaskRunner()->RunsTasksOnCurrentThread()); | 70 DCHECK(old_indexed_db_context->TaskRunner()->RunsTasksInCurrentSequence()); |
71 | 71 |
72 GURL extension_url = | 72 GURL extension_url = |
73 extensions::Extension::GetBaseURLFromExtensionId(extension->id()); | 73 extensions::Extension::GetBaseURLFromExtensionId(extension->id()); |
74 | 74 |
75 old_indexed_db_context->CopyOriginData(extension_url, indexed_db_context); | 75 old_indexed_db_context->CopyOriginData(extension_url, indexed_db_context); |
76 } | 76 } |
77 | 77 |
78 void MigrateFileSystem(WeakPtr<extensions::AppDataMigrator> migrator, | 78 void MigrateFileSystem(WeakPtr<extensions::AppDataMigrator> migrator, |
79 StoragePartition* old_partition, | 79 StoragePartition* old_partition, |
80 StoragePartition* current_partition, | 80 StoragePartition* current_partition, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (old_was_disabled) | 170 if (old_was_disabled) |
171 registry_->RemoveEnabled(extension->id()); | 171 registry_->RemoveEnabled(extension->id()); |
172 else | 172 else |
173 registry_->AddEnabled(old); | 173 registry_->AddEnabled(old); |
174 | 174 |
175 MigrateLegacyPartition(weak_factory_.GetWeakPtr(), old_partition, | 175 MigrateLegacyPartition(weak_factory_.GetWeakPtr(), old_partition, |
176 new_partition, extension, reply); | 176 new_partition, extension, reply); |
177 } | 177 } |
178 | 178 |
179 } // namespace extensions | 179 } // namespace extensions |
OLD | NEW |