Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/loader/resource_requester_info.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/memory/ptr_util.h" | |
| 9 #include "content/browser/appcache/chrome_appcache_service.h" | |
| 10 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | |
| 11 #include "content/browser/loader/resource_message_filter.h" | |
| 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | |
| 13 #include "content/public/browser/resource_context.h" | |
| 14 #include "storage/browser/fileapi/file_system_context.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 ResourceRequesterInfo::ResourceRequesterInfo( | |
| 19 RequesterType type, | |
| 20 int child_id, | |
| 21 ChromeAppCacheService* appcache_service, | |
| 22 ChromeBlobStorageContext* blob_storage_context, | |
| 23 storage::FileSystemContext* file_system_context, | |
| 24 ServiceWorkerContextWrapper* service_worker_context, | |
| 25 const GetContextsCallback& get_contexts_callback) | |
| 26 : type_(type), | |
| 27 child_id_(child_id), | |
| 28 appcache_service_(appcache_service), | |
| 29 blob_storage_context_(blob_storage_context), | |
| 30 file_system_context_(file_system_context), | |
| 31 service_worker_context_(service_worker_context), | |
| 32 get_contexts_callback_(get_contexts_callback) {} | |
| 33 | |
| 34 ResourceRequesterInfo::~ResourceRequesterInfo() {} | |
| 35 | |
| 36 void ResourceRequesterInfo::set_filter( | |
| 37 base::WeakPtr<ResourceMessageFilter> filter) { | |
| 38 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
|
mmenke
2016/11/21 19:51:56
include browser_thread
horo
2016/11/22 01:12:08
Done.
| |
| 39 DCHECK_EQ(RequesterType::RENDERER, type_); | |
| 40 filter_ = filter; | |
| 41 } | |
| 42 | |
| 43 void ResourceRequesterInfo::GetContexts( | |
| 44 ResourceType resource_type, | |
| 45 ResourceContext** resource_context, | |
| 46 net::URLRequestContext** request_context) const { | |
| 47 get_contexts_callback_.Run(resource_type, resource_context, request_context); | |
| 48 } | |
| 49 | |
| 50 scoped_refptr<ResourceRequesterInfo> ResourceRequesterInfo::CreateForRenderer( | |
| 51 int child_id, | |
| 52 ChromeAppCacheService* appcache_service, | |
| 53 ChromeBlobStorageContext* blob_storage_context, | |
| 54 storage::FileSystemContext* file_system_context, | |
| 55 ServiceWorkerContextWrapper* service_worker_context, | |
| 56 const GetContextsCallback& get_contexts_callback) { | |
| 57 return scoped_refptr<ResourceRequesterInfo>(new ResourceRequesterInfo( | |
| 58 RequesterType::RENDERER, child_id, appcache_service, blob_storage_context, | |
| 59 file_system_context, service_worker_context, get_contexts_callback)); | |
| 60 } | |
| 61 | |
| 62 scoped_refptr<ResourceRequesterInfo> | |
| 63 ResourceRequesterInfo::CreateForRendererTesting(int child_id) { | |
| 64 return scoped_refptr<ResourceRequesterInfo>(new ResourceRequesterInfo( | |
| 65 RequesterType::RENDERER, child_id, nullptr /* appcache_service */, | |
| 66 nullptr /* blob_storage_context */, nullptr /* file_system_context */, | |
| 67 nullptr /*service_worker_context */, GetContextsCallback())); | |
| 68 } | |
| 69 | |
| 70 scoped_refptr<ResourceRequesterInfo> | |
| 71 ResourceRequesterInfo::CreateForBrowserSideNavigation( | |
| 72 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) { | |
| 73 return scoped_refptr<ResourceRequesterInfo>(new ResourceRequesterInfo( | |
| 74 RequesterType::BROWSER_SIDE_NAVIGATION, -1, | |
| 75 nullptr /* appcache_service */, nullptr /* blob_storage_context */, | |
| 76 nullptr /* file_system_context */, service_worker_context.get(), | |
| 77 GetContextsCallback())); | |
| 78 } | |
| 79 | |
| 80 scoped_refptr<ResourceRequesterInfo> | |
| 81 ResourceRequesterInfo::CreateForDownloadOrPageSave(int child_id) { | |
| 82 return scoped_refptr<ResourceRequesterInfo>(new ResourceRequesterInfo( | |
| 83 RequesterType::DOWNLOAD_OR_PAGE_SAVE, child_id, | |
| 84 nullptr /* appcache_service */, nullptr /* blob_storage_context */, | |
| 85 nullptr /* file_system_context */, nullptr /*service_worker_context */, | |
| 86 GetContextsCallback())); | |
| 87 } | |
| 88 | |
| 89 } // namespace content | |
| OLD | NEW |