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" |
11 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 11 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 12 #include "content/browser/push_messaging_router.h" |
12 #include "content/browser/storage_partition_impl_map.h" | 13 #include "content/browser/storage_partition_impl_map.h" |
13 #include "content/common/child_process_host_impl.h" | 14 #include "content/common/child_process_host_impl.h" |
14 #include "content/public/browser/blob_handle.h" | 15 #include "content/public/browser/blob_handle.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
17 #include "content/public/browser/site_instance.h" | 18 #include "content/public/browser/site_instance.h" |
18 #include "net/cookies/cookie_monster.h" | 19 #include "net/cookies/cookie_monster.h" |
19 #include "net/cookies/cookie_store.h" | 20 #include "net/cookies/cookie_store.h" |
20 #include "net/ssl/channel_id_service.h" | 21 #include "net/ssl/channel_id_service.h" |
21 #include "net/ssl/channel_id_store.h" | 22 #include "net/ssl/channel_id_store.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 ChromeBlobStorageContext* blob_context = | 207 ChromeBlobStorageContext* blob_context = |
207 ChromeBlobStorageContext::GetFor(browser_context); | 208 ChromeBlobStorageContext::GetFor(browser_context); |
208 BrowserThread::PostTaskAndReplyWithResult( | 209 BrowserThread::PostTaskAndReplyWithResult( |
209 BrowserThread::IO, FROM_HERE, | 210 BrowserThread::IO, FROM_HERE, |
210 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob, | 211 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob, |
211 make_scoped_refptr(blob_context), data, length), | 212 make_scoped_refptr(blob_context), data, length), |
212 callback); | 213 callback); |
213 } | 214 } |
214 | 215 |
| 216 // static |
| 217 void BrowserContext::DeliverPushMessage( |
| 218 BrowserContext* browser_context, |
| 219 const GURL& origin, |
| 220 int64 service_worker_registration_id, |
| 221 const std::string& data, |
| 222 const base::Callback<void(PushMessagingStatus)>& callback) { |
| 223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 224 PushMessagingRouter::DeliverMessage( |
| 225 browser_context, origin, service_worker_registration_id, data, callback); |
| 226 } |
| 227 |
215 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { | 228 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { |
216 // This will be enough to tickle initialization of BrowserContext if | 229 // This will be enough to tickle initialization of BrowserContext if |
217 // necessary, which initializes ResourceContext. The reason we don't call | 230 // necessary, which initializes ResourceContext. The reason we don't call |
218 // ResourceContext::InitializeResourceContext() directly here is that | 231 // ResourceContext::InitializeResourceContext() directly here is that |
219 // ResourceContext initialization may call back into BrowserContext | 232 // ResourceContext initialization may call back into BrowserContext |
220 // and when that call returns it'll end rewriting its UserData map. It will | 233 // and when that call returns it'll end rewriting its UserData map. It will |
221 // end up rewriting the same value but this still causes a race condition. | 234 // end up rewriting the same value but this still causes a race condition. |
222 // | 235 // |
223 // See http://crbug.com/115678. | 236 // See http://crbug.com/115678. |
224 GetDefaultStoragePartition(context); | 237 GetDefaultStoragePartition(context); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 #endif // !OS_IOS | 273 #endif // !OS_IOS |
261 | 274 |
262 BrowserContext::~BrowserContext() { | 275 BrowserContext::~BrowserContext() { |
263 #if !defined(OS_IOS) | 276 #if !defined(OS_IOS) |
264 if (GetUserData(kDownloadManagerKeyName)) | 277 if (GetUserData(kDownloadManagerKeyName)) |
265 GetDownloadManager(this)->Shutdown(); | 278 GetDownloadManager(this)->Shutdown(); |
266 #endif | 279 #endif |
267 } | 280 } |
268 | 281 |
269 } // namespace content | 282 } // namespace content |
OLD | NEW |