Index: content/browser/storage_partition_impl.cc |
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc |
index 7ba19db086d3e608d288eec93a9530ff70a6b603..57a214934bc4f7655366105d3c6536d30118fac5 100644 |
--- a/content/browser/storage_partition_impl.cc |
+++ b/content/browser/storage_partition_impl.cc |
@@ -4,6 +4,7 @@ |
#include "content/browser/storage_partition_impl.h" |
+#include "base/utf_string_conversions.h" |
#include "content/browser/fileapi/browser_file_system_helper.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
@@ -39,18 +40,18 @@ const FilePath::CharType kDefaultPartitionDirname[] = |
} // namespace |
// static |
-FilePath StoragePartition::GetPartitionPath(const std::string& partition_id) { |
- if (partition_id.empty()) { |
- // The default profile just sits inside the top-level profile directory. |
+FilePath StoragePartitionImpl::GetStoragePartitionPath( |
+ const StoragePartitionDescriptor& descriptor) { |
+ if (descriptor.partition_domain.empty()) |
return FilePath(); |
- } |
- // TODO(ajwong): This should check that we create a valid path name. |
- CHECK(IsStringASCII(partition_id)); |
- return FilePath(kStoragePartitionDirname) |
- .Append(kExtensionsDirname) |
- .AppendASCII(partition_id) |
- .Append(kDefaultPartitionDirname); |
+ FilePath path = FilePath(kStoragePartitionDirname).Append(kExtensionsDirname) |
Charlie Reis
2012/11/06 00:17:18
nit: I think the dot goes on this line in Chrome s
|
+ .AppendASCII(descriptor.partition_domain); |
awong
2012/11/05 23:48:37
Do we want this to also be UTF8? Having 2 differe
nasko
2012/11/06 01:21:52
This is known to be ASCII, since it is the app ID.
|
+ |
+ if (!descriptor.partition_name.empty()) |
+ return path.Append(FilePath::FromUTF8Unsafe(descriptor.partition_name)); |
+ |
+ return path.Append(kDefaultPartitionDirname); |
} |
StoragePartitionImpl::StoragePartitionImpl( |
@@ -88,7 +89,7 @@ StoragePartitionImpl::~StoragePartitionImpl() { |
// need 3 pieces of info from it. |
StoragePartitionImpl* StoragePartitionImpl::Create( |
BrowserContext* context, |
- const std::string& partition_id, |
+ const StoragePartitionDescriptor& partition_descriptor, |
const FilePath& profile_path) { |
// Ensure that these methods are called on the UI thread, except for |
// unittests where a UI thread might not have been created. |
@@ -96,7 +97,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create( |
!BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
FilePath partition_path = |
- profile_path.Append(GetPartitionPath(partition_id)); |
+ profile_path.Append(GetStoragePartitionPath(partition_descriptor)); |
// All of the clients have to be created and registered with the |
// QuotaManager prior to the QuotaManger being used. We do them |
@@ -104,7 +105,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create( |
// that utilizes the QuotaManager. |
scoped_refptr<quota::QuotaManager> quota_manager = |
new quota::QuotaManager( |
- context->IsOffTheRecord(), partition_path, |
+ partition_descriptor.in_memory, partition_path, |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
context->GetSpecialStoragePolicy()); |
@@ -112,17 +113,17 @@ StoragePartitionImpl* StoragePartitionImpl::Create( |
// Each consumer is responsible for registering its QuotaClient during |
// its construction. |
scoped_refptr<fileapi::FileSystemContext> filesystem_context = |
- CreateFileSystemContext(partition_path, context->IsOffTheRecord(), |
+ CreateFileSystemContext(partition_path, partition_descriptor.in_memory, |
context->GetSpecialStoragePolicy(), |
quota_manager->proxy()); |
scoped_refptr<webkit_database::DatabaseTracker> database_tracker = |
new webkit_database::DatabaseTracker( |
- partition_path, context->IsOffTheRecord(), |
+ partition_path, partition_descriptor.in_memory, |
context->GetSpecialStoragePolicy(), quota_manager->proxy(), |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
- FilePath path = context->IsOffTheRecord() ? FilePath() : partition_path; |
+ FilePath path = partition_descriptor.in_memory ? FilePath() : partition_path; |
scoped_refptr<DOMStorageContextImpl> dom_storage_context = |
new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); |