| 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/browser/storage_partition_impl_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" | 
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 56 | 56 | 
| 57   virtual ~BlobProtocolHandler() {} | 57   virtual ~BlobProtocolHandler() {} | 
| 58 | 58 | 
| 59   virtual net::URLRequestJob* MaybeCreateJob( | 59   virtual net::URLRequestJob* MaybeCreateJob( | 
| 60       net::URLRequest* request, | 60       net::URLRequest* request, | 
| 61       net::NetworkDelegate* network_delegate) const OVERRIDE { | 61       net::NetworkDelegate* network_delegate) const OVERRIDE { | 
| 62     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 62     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 
| 63     if (!webkit_blob_protocol_handler_impl_) { | 63     if (!webkit_blob_protocol_handler_impl_) { | 
| 64       webkit_blob_protocol_handler_impl_.reset( | 64       webkit_blob_protocol_handler_impl_.reset( | 
| 65           new WebKitBlobProtocolHandlerImpl(blob_storage_context_->controller(), | 65           new WebKitBlobProtocolHandlerImpl(blob_storage_context_->controller(), | 
| 66                                             stream_context_, | 66                                             stream_context_.get(), | 
| 67                                             file_system_context_)); | 67                                             file_system_context_.get())); | 
| 68     } | 68     } | 
| 69     return webkit_blob_protocol_handler_impl_->MaybeCreateJob(request, | 69     return webkit_blob_protocol_handler_impl_->MaybeCreateJob(request, | 
| 70                                                               network_delegate); | 70                                                               network_delegate); | 
| 71   } | 71   } | 
| 72 | 72 | 
| 73  private: | 73  private: | 
| 74   // An implementation of webkit_blob::BlobProtocolHandler that gets | 74   // An implementation of webkit_blob::BlobProtocolHandler that gets | 
| 75   // the BlobData from ResourceRequestInfoImpl. | 75   // the BlobData from ResourceRequestInfoImpl. | 
| 76   class WebKitBlobProtocolHandlerImpl | 76   class WebKitBlobProtocolHandlerImpl | 
| 77       : public webkit_blob::BlobProtocolHandler { | 77       : public webkit_blob::BlobProtocolHandler { | 
| 78    public: | 78    public: | 
| 79     WebKitBlobProtocolHandlerImpl( | 79     WebKitBlobProtocolHandlerImpl( | 
| 80         webkit_blob::BlobStorageController* blob_storage_controller, | 80         webkit_blob::BlobStorageController* blob_storage_controller, | 
| 81         StreamContext* stream_context, | 81         StreamContext* stream_context, | 
| 82         fileapi::FileSystemContext* file_system_context) | 82         fileapi::FileSystemContext* file_system_context) | 
| 83         : webkit_blob::BlobProtocolHandler( | 83         : webkit_blob::BlobProtocolHandler( | 
| 84               blob_storage_controller, file_system_context, | 84               blob_storage_controller, file_system_context, | 
| 85               BrowserThread::GetMessageLoopProxyForThread( | 85               BrowserThread::GetMessageLoopProxyForThread( | 
| 86                   BrowserThread::FILE)), | 86                   BrowserThread::FILE)), | 
| 87           stream_context_(stream_context) {} | 87           stream_context_(stream_context) {} | 
| 88 | 88 | 
| 89     virtual ~WebKitBlobProtocolHandlerImpl() {} | 89     virtual ~WebKitBlobProtocolHandlerImpl() {} | 
| 90 | 90 | 
| 91     virtual net::URLRequestJob* MaybeCreateJob( | 91     virtual net::URLRequestJob* MaybeCreateJob( | 
| 92         net::URLRequest* request, | 92         net::URLRequest* request, | 
| 93         net::NetworkDelegate* network_delegate) const OVERRIDE { | 93         net::NetworkDelegate* network_delegate) const OVERRIDE { | 
| 94       scoped_refptr<Stream> stream = | 94       scoped_refptr<Stream> stream = | 
| 95           stream_context_->registry()->GetStream(request->url()); | 95           stream_context_->registry()->GetStream(request->url()); | 
| 96       if (stream) | 96       if (stream.get()) | 
| 97         return new StreamURLRequestJob(request, network_delegate, stream); | 97         return new StreamURLRequestJob(request, network_delegate, stream); | 
| 98 | 98 | 
| 99       return webkit_blob::BlobProtocolHandler::MaybeCreateJob( | 99       return webkit_blob::BlobProtocolHandler::MaybeCreateJob( | 
| 100           request, network_delegate); | 100           request, network_delegate); | 
| 101     } | 101     } | 
| 102 | 102 | 
| 103    private: | 103    private: | 
| 104     // webkit_blob::BlobProtocolHandler implementation. | 104     // webkit_blob::BlobProtocolHandler implementation. | 
| 105     virtual scoped_refptr<webkit_blob::BlobData> | 105     virtual scoped_refptr<webkit_blob::BlobData> | 
| 106         LookupBlobData(net::URLRequest* request) const OVERRIDE { | 106         LookupBlobData(net::URLRequest* request) const OVERRIDE { | 
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 578 | 578 | 
| 579     // We do not call InitializeURLRequestContext() for media contexts because, | 579     // We do not call InitializeURLRequestContext() for media contexts because, | 
| 580     // other than the HTTP cache, the media contexts share the same backing | 580     // other than the HTTP cache, the media contexts share the same backing | 
| 581     // objects as their associated "normal" request context.  Thus, the previous | 581     // objects as their associated "normal" request context.  Thus, the previous | 
| 582     // call serves to initialize the media request context for this storage | 582     // call serves to initialize the media request context for this storage | 
| 583     // partition as well. | 583     // partition as well. | 
| 584   } | 584   } | 
| 585 } | 585 } | 
| 586 | 586 | 
| 587 }  // namespace content | 587 }  // namespace content | 
| OLD | NEW | 
|---|