OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/storage_partition_impl_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 StoragePartitionImpl* StoragePartitionImplMap::Get( | 31 StoragePartitionImpl* StoragePartitionImplMap::Get( |
32 const std::string& partition_id) { | 32 const std::string& partition_id) { |
33 // Find the previously created partition if it's available. | 33 // Find the previously created partition if it's available. |
34 std::map<std::string, StoragePartitionImpl*>::const_iterator it = | 34 std::map<std::string, StoragePartitionImpl*>::const_iterator it = |
35 partitions_.find(partition_id); | 35 partitions_.find(partition_id); |
36 if (it != partitions_.end()) | 36 if (it != partitions_.end()) |
37 return it->second; | 37 return it->second; |
38 | 38 |
39 // There was no previous partition, so let's make a new one. | 39 // There was no previous partition, so let's make a new one. |
| 40 // |
| 41 // TODO(ajwong): Move the the path construciton logic into |
| 42 // StoragePartitionImpl::Create() once we get the |
| 43 // PostCreateInitialization() ordering sorted out. |
40 FilePath partition_path = browser_context_->GetPath(); | 44 FilePath partition_path = browser_context_->GetPath(); |
41 if (!partition_id.empty()) { | 45 if (!partition_id.empty()) { |
42 // TODO(ajwong): This should check the path is valid? | 46 // TODO(ajwong): This should check the path is valid? |
43 CHECK(IsStringASCII(partition_id)); | 47 CHECK(IsStringASCII(partition_id)); |
44 partition_path = partition_path.Append(kStoragePartitionDirname) | 48 partition_path = partition_path.Append(kStoragePartitionDirname) |
45 .AppendASCII(partition_id); | 49 .AppendASCII(partition_id); |
46 } | 50 } |
47 | 51 |
48 StoragePartitionImpl* storage_partition = | 52 StoragePartitionImpl* storage_partition = |
49 StoragePartitionImpl::Create(browser_context_, partition_path); | 53 StoragePartitionImpl::Create(browser_context_, partition_id, |
| 54 partition_path); |
50 partitions_[partition_id] = storage_partition; | 55 partitions_[partition_id] = storage_partition; |
51 | 56 |
52 PostCreateInitialization(storage_partition, partition_path); | 57 PostCreateInitialization(storage_partition, partition_path); |
53 | 58 |
54 // TODO(ajwong): We need to remove this conditional by making | 59 // TODO(ajwong): We need to remove this conditional by making |
55 // InitializeResourceContext() understand having different partition data | 60 // InitializeResourceContext() understand having different partition data |
56 // based on the renderer_id. | 61 // based on the renderer_id. |
57 if (partition_id.empty()) { | 62 if (partition_id.empty()) { |
58 InitializeResourceContext(browser_context_); | 63 InitializeResourceContext(browser_context_); |
59 } | 64 } |
(...skipping 26 matching lines...) Expand all Loading... |
86 // using the cookies and cache of a the default | 91 // using the cookies and cache of a the default |
87 // partition when populating the cache. | 92 // partition when populating the cache. |
88 // http://crbug.com/85121 | 93 // http://crbug.com/85121 |
89 browser_context_->GetResourceContext(), | 94 browser_context_->GetResourceContext(), |
90 make_scoped_refptr( | 95 make_scoped_refptr( |
91 browser_context_->GetSpecialStoragePolicy()))); | 96 browser_context_->GetSpecialStoragePolicy()))); |
92 } | 97 } |
93 } | 98 } |
94 | 99 |
95 } // namespace content | 100 } // namespace content |
OLD | NEW |