| 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 #if !defined(OS_IOS) | 7 #if !defined(OS_IOS) |
| 8 #include "content/browser/download/download_manager_impl.h" | 8 #include "content/browser/download/download_manager_impl.h" |
| 9 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 9 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 10 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 10 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 partition_map->ForEach(callback); | 201 partition_map->ForEach(callback); |
| 202 } | 202 } |
| 203 | 203 |
| 204 StoragePartition* BrowserContext::GetDefaultStoragePartition( | 204 StoragePartition* BrowserContext::GetDefaultStoragePartition( |
| 205 BrowserContext* browser_context) { | 205 BrowserContext* browser_context) { |
| 206 return GetStoragePartition(browser_context, NULL); | 206 return GetStoragePartition(browser_context, NULL); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // static |
| 209 void BrowserContext::CreateMemoryBackedBlob(BrowserContext* browser_context, | 210 void BrowserContext::CreateMemoryBackedBlob(BrowserContext* browser_context, |
| 210 const char* data, size_t length, | 211 const char* data, size_t length, |
| 211 const BlobCallback& callback) { | 212 const BlobCallback& callback) { |
| 212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 213 | 214 |
| 214 ChromeBlobStorageContext* blob_context = | 215 ChromeBlobStorageContext* blob_context = |
| 215 ChromeBlobStorageContext::GetFor(browser_context); | 216 ChromeBlobStorageContext::GetFor(browser_context); |
| 216 BrowserThread::PostTaskAndReplyWithResult( | 217 BrowserThread::PostTaskAndReplyWithResult( |
| 217 BrowserThread::IO, FROM_HERE, | 218 BrowserThread::IO, FROM_HERE, |
| 218 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob, | 219 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob, |
| 219 make_scoped_refptr(blob_context), data, length), | 220 make_scoped_refptr(blob_context), data, length), |
| 220 callback); | 221 callback); |
| 221 } | 222 } |
| 222 | 223 |
| 223 // static | 224 // static |
| 225 void BrowserContext::CreateFileBackedBlob( |
| 226 BrowserContext* browser_context, |
| 227 const base::FilePath& path, |
| 228 int64_t offset, |
| 229 int64_t size, |
| 230 const base::Time& expected_modification_time, |
| 231 const BlobCallback& callback) { |
| 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 233 |
| 234 ChromeBlobStorageContext* blob_context = |
| 235 ChromeBlobStorageContext::GetFor(browser_context); |
| 236 BrowserThread::PostTaskAndReplyWithResult( |
| 237 BrowserThread::IO, FROM_HERE, |
| 238 base::Bind(&ChromeBlobStorageContext::CreateFileBackedBlob, |
| 239 make_scoped_refptr(blob_context), path, offset, size, |
| 240 expected_modification_time), |
| 241 callback); |
| 242 } |
| 243 |
| 244 // static |
| 224 void BrowserContext::DeliverPushMessage( | 245 void BrowserContext::DeliverPushMessage( |
| 225 BrowserContext* browser_context, | 246 BrowserContext* browser_context, |
| 226 const GURL& origin, | 247 const GURL& origin, |
| 227 int64 service_worker_registration_id, | 248 int64 service_worker_registration_id, |
| 228 const std::string& data, | 249 const std::string& data, |
| 229 const base::Callback<void(PushDeliveryStatus)>& callback) { | 250 const base::Callback<void(PushDeliveryStatus)>& callback) { |
| 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 231 PushMessagingRouter::DeliverMessage( | 252 PushMessagingRouter::DeliverMessage( |
| 232 browser_context, origin, service_worker_registration_id, data, callback); | 253 browser_context, origin, service_worker_registration_id, data, callback); |
| 233 } | 254 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 #endif // !OS_IOS | 310 #endif // !OS_IOS |
| 290 | 311 |
| 291 BrowserContext::~BrowserContext() { | 312 BrowserContext::~BrowserContext() { |
| 292 #if !defined(OS_IOS) | 313 #if !defined(OS_IOS) |
| 293 if (GetUserData(kDownloadManagerKeyName)) | 314 if (GetUserData(kDownloadManagerKeyName)) |
| 294 GetDownloadManager(this)->Shutdown(); | 315 GetDownloadManager(this)->Shutdown(); |
| 295 #endif | 316 #endif |
| 296 } | 317 } |
| 297 | 318 |
| 298 } // namespace content | 319 } // namespace content |
| OLD | NEW |