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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include "content/browser/appcache/chrome_appcache_service.h" | 7 #include "content/browser/appcache/chrome_appcache_service.h" |
8 #include "webkit/database/database_tracker.h" | 8 #include "webkit/database/database_tracker.h" |
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
10 #include "content/browser/download/download_file_manager.h" | 10 #include "content/browser/download/download_file_manager.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 fileapi::FileSystemContext* BrowserContext::GetFileSystemContext( | 204 fileapi::FileSystemContext* BrowserContext::GetFileSystemContext( |
205 BrowserContext* browser_context) { | 205 BrowserContext* browser_context) { |
206 // TODO(ajwong): Change this API to require a process id instead of using | 206 // TODO(ajwong): Change this API to require a process id instead of using |
207 // kInvalidChildProcessId. | 207 // kInvalidChildProcessId. |
208 StoragePartition* partition = | 208 StoragePartition* partition = |
209 GetStoragePartition(browser_context, | 209 GetStoragePartition(browser_context, |
210 ChildProcessHostImpl::kInvalidChildProcessId); | 210 ChildProcessHostImpl::kInvalidChildProcessId); |
211 return partition->filesystem_context(); | 211 return partition->filesystem_context(); |
212 } | 212 } |
213 | 213 |
| 214 bool BrowserContext::IsValidStoragePartitionId( |
| 215 BrowserContext* browser_context, |
| 216 const std::string& partition_id) { |
| 217 return GetContentClient()->browser()->IsValidStoragePartitionId( |
| 218 browser_context, partition_id); |
| 219 } |
| 220 |
214 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { | 221 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { |
215 // This will be enough to tickle initialization of BrowserContext if | 222 // This will be enough to tickle initialization of BrowserContext if |
216 // necessary, which initializes ResourceContext. The reason we don't call | 223 // necessary, which initializes ResourceContext. The reason we don't call |
217 // ResourceContext::InitializeResourceContext directly here is that if | 224 // ResourceContext::InitializeResourceContext directly here is that if |
218 // ResourceContext ends up initializing it will call back into BrowserContext | 225 // ResourceContext ends up initializing it will call back into BrowserContext |
219 // and when that call returns it'll end rewriting its UserData map (with the | 226 // and when that call returns it'll end rewriting its UserData map (with the |
220 // same value) but this causes a race condition. See http://crbug.com/115678. | 227 // same value) but this causes a race condition. See http://crbug.com/115678. |
221 GetStoragePartition(context, ChildProcessHostImpl::kInvalidChildProcessId); | 228 GetStoragePartition(context, ChildProcessHostImpl::kInvalidChildProcessId); |
222 } | 229 } |
223 | 230 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 ForEachDOMStorageContext(browser_context, | 264 ForEachDOMStorageContext(browser_context, |
258 base::Bind(&DOMStorageContextImpl::PurgeMemory)); | 265 base::Bind(&DOMStorageContextImpl::PurgeMemory)); |
259 } | 266 } |
260 | 267 |
261 BrowserContext::~BrowserContext() { | 268 BrowserContext::~BrowserContext() { |
262 if (GetUserData(kDownloadManagerKeyName)) | 269 if (GetUserData(kDownloadManagerKeyName)) |
263 GetDownloadManager(this)->Shutdown(); | 270 GetDownloadManager(this)->Shutdown(); |
264 } | 271 } |
265 | 272 |
266 } // namespace content | 273 } // namespace content |
OLD | NEW |