| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/blob/blob_url_request_job_factory.h" | 5 #include "webkit/blob/blob_url_request_job_factory.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
| 11 #include "net/url_request/url_request_job_factory.h" | 11 #include "net/url_request/url_request_job_factory.h" |
| 12 #include "webkit/blob/blob_storage_controller.h" | 12 #include "webkit/blob/blob_storage_controller.h" |
| 13 #include "webkit/blob/blob_url_request_job.h" | 13 #include "webkit/blob/blob_url_request_job.h" |
| 14 #include "webkit/fileapi/file_system_context.h" |
| 14 | 15 |
| 15 namespace webkit_blob { | 16 namespace webkit_blob { |
| 16 | 17 |
| 17 BlobProtocolHandler::BlobProtocolHandler( | 18 BlobProtocolHandler::BlobProtocolHandler( |
| 18 webkit_blob::BlobStorageController* blob_storage_controller, | 19 webkit_blob::BlobStorageController* blob_storage_controller, |
| 20 fileapi::FileSystemContext* file_system_context, |
| 19 base::MessageLoopProxy* loop_proxy) | 21 base::MessageLoopProxy* loop_proxy) |
| 20 : blob_storage_controller_(blob_storage_controller), | 22 : blob_storage_controller_(blob_storage_controller), |
| 23 file_system_context_(file_system_context), |
| 21 file_loop_proxy_(loop_proxy) { | 24 file_loop_proxy_(loop_proxy) { |
| 22 DCHECK(blob_storage_controller); | 25 DCHECK(blob_storage_controller_); |
| 26 DCHECK(file_system_context_); |
| 23 DCHECK(file_loop_proxy_); | 27 DCHECK(file_loop_proxy_); |
| 24 } | 28 } |
| 25 | 29 |
| 26 BlobProtocolHandler::~BlobProtocolHandler() {} | 30 BlobProtocolHandler::~BlobProtocolHandler() {} |
| 27 | 31 |
| 28 net::URLRequestJob* BlobProtocolHandler::MaybeCreateJob( | 32 net::URLRequestJob* BlobProtocolHandler::MaybeCreateJob( |
| 29 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 33 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 30 scoped_refptr<webkit_blob::BlobData> data = LookupBlobData(request); | 34 scoped_refptr<webkit_blob::BlobData> data = LookupBlobData(request); |
| 31 if (!data) { | 35 if (!data) { |
| 32 // This request is not coming through resource dispatcher host. | 36 // This request is not coming through resource dispatcher host. |
| 33 data = blob_storage_controller_->GetBlobDataFromUrl(request->url()); | 37 data = blob_storage_controller_->GetBlobDataFromUrl(request->url()); |
| 34 } | 38 } |
| 35 return new webkit_blob::BlobURLRequestJob( | 39 return new webkit_blob::BlobURLRequestJob( |
| 36 request, network_delegate, data, file_loop_proxy_); | 40 request, network_delegate, data, file_system_context_, file_loop_proxy_); |
| 37 } | 41 } |
| 38 | 42 |
| 39 scoped_refptr<webkit_blob::BlobData> | 43 scoped_refptr<webkit_blob::BlobData> |
| 40 BlobProtocolHandler::LookupBlobData(net::URLRequest* request) const { | 44 BlobProtocolHandler::LookupBlobData(net::URLRequest* request) const { |
| 41 return NULL; | 45 return NULL; |
| 42 } | 46 } |
| 43 | 47 |
| 44 } // namespace webkit_blob | 48 } // namespace webkit_blob |
| OLD | NEW |