| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // There was no previous partition, so let's make a new one. | 206 // There was no previous partition, so let's make a new one. |
| 207 StoragePartitionImpl* partition = | 207 StoragePartitionImpl* partition = |
| 208 StoragePartitionImpl::Create(browser_context_, partition_id, | 208 StoragePartitionImpl::Create(browser_context_, partition_id, |
| 209 browser_context_->GetPath()); | 209 browser_context_->GetPath()); |
| 210 partitions_[partition_id] = partition; | 210 partitions_[partition_id] = partition; |
| 211 | 211 |
| 212 // These calls must happen after StoragePartitionImpl::Create(). | 212 // These calls must happen after StoragePartitionImpl::Create(). |
| 213 partition->SetURLRequestContext( | 213 partition->SetURLRequestContext( |
| 214 partition_id.empty() ? | 214 partition_id.empty() ? |
| 215 browser_context_->GetRequestContext() : | 215 browser_context_->GetRequestContext() : |
| 216 browser_context_->GetRequestContextForStoragePartition(partition_id)); | 216 browser_context_->GetRequestContextForStoragePartition( |
| 217 partition->GetPath(), false)); |
| 217 partition->SetMediaURLRequestContext( | 218 partition->SetMediaURLRequestContext( |
| 218 partition_id.empty() ? | 219 partition_id.empty() ? |
| 219 browser_context_->GetMediaRequestContext() : | 220 browser_context_->GetMediaRequestContext() : |
| 220 browser_context_->GetMediaRequestContextForStoragePartition( | 221 browser_context_->GetMediaRequestContextForStoragePartition( |
| 221 partition_id)); | 222 partition->GetPath(), false)); |
| 222 | 223 |
| 223 PostCreateInitialization(partition); | 224 PostCreateInitialization(partition); |
| 224 | 225 |
| 225 // TODO(ajwong): ResourceContexts no longer have any storage related state. | 226 // TODO(ajwong): ResourceContexts no longer have any storage related state. |
| 226 // We should move this into a place where it is called once per | 227 // We should move this into a place where it is called once per |
| 227 // BrowserContext creation rather than piggybacking off the default context | 228 // BrowserContext creation rather than piggybacking off the default context |
| 228 // creation. | 229 // creation. |
| 229 if (partition_id.empty()) { | 230 if (partition_id.empty()) { |
| 230 InitializeResourceContext(browser_context_); | 231 InitializeResourceContext(browser_context_); |
| 231 } | 232 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 272 |
| 272 // We do not call InitializeURLRequestContext() for media contexts because, | 273 // We do not call InitializeURLRequestContext() for media contexts because, |
| 273 // other than the HTTP cache, the media contexts share the same backing | 274 // other than the HTTP cache, the media contexts share the same backing |
| 274 // objects as their associated "normal" request context. Thus, the previous | 275 // objects as their associated "normal" request context. Thus, the previous |
| 275 // call serves to initialize the media request context for this storage | 276 // call serves to initialize the media request context for this storage |
| 276 // partition as well. | 277 // partition as well. |
| 277 } | 278 } |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace content | 281 } // namespace content |
| OLD | NEW |