| 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_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 using webkit_blob::BlobStorageController; | 37 using webkit_blob::BlobStorageController; |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 class BlobProtocolHandler : public webkit_blob::BlobProtocolHandler { | 43 class BlobProtocolHandler : public webkit_blob::BlobProtocolHandler { |
| 44 public: | 44 public: |
| 45 BlobProtocolHandler( | 45 BlobProtocolHandler( |
| 46 webkit_blob::BlobStorageController* blob_storage_controller, | 46 webkit_blob::BlobStorageController* blob_storage_controller, |
| 47 fileapi::FileSystemContext* file_system_context, |
| 47 base::MessageLoopProxy* loop_proxy) | 48 base::MessageLoopProxy* loop_proxy) |
| 48 : webkit_blob::BlobProtocolHandler(blob_storage_controller, | 49 : webkit_blob::BlobProtocolHandler(blob_storage_controller, |
| 50 file_system_context, |
| 49 loop_proxy) {} | 51 loop_proxy) {} |
| 50 | 52 |
| 51 virtual ~BlobProtocolHandler() {} | 53 virtual ~BlobProtocolHandler() {} |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 virtual scoped_refptr<webkit_blob::BlobData> | 56 virtual scoped_refptr<webkit_blob::BlobData> |
| 55 LookupBlobData(net::URLRequest* request) const { | 57 LookupBlobData(net::URLRequest* request) const { |
| 56 const ResourceRequestInfoImpl* info = | 58 const ResourceRequestInfoImpl* info = |
| 57 ResourceRequestInfoImpl::ForRequest(request); | 59 ResourceRequestInfoImpl::ForRequest(request); |
| 58 if (!info) | 60 if (!info) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Note: if this is called twice with 2 request contexts that share one job | 162 // Note: if this is called twice with 2 request contexts that share one job |
| 161 // factory (as is the case with a media request context and its related | 163 // factory (as is the case with a media request context and its related |
| 162 // normal request context) then this will early exit. | 164 // normal request context) then this will early exit. |
| 163 if (job_factory->IsHandledProtocol(chrome::kBlobScheme)) | 165 if (job_factory->IsHandledProtocol(chrome::kBlobScheme)) |
| 164 return; // Already initialized this JobFactory. | 166 return; // Already initialized this JobFactory. |
| 165 | 167 |
| 166 bool set_protocol = job_factory->SetProtocolHandler( | 168 bool set_protocol = job_factory->SetProtocolHandler( |
| 167 chrome::kBlobScheme, | 169 chrome::kBlobScheme, |
| 168 new BlobProtocolHandler( | 170 new BlobProtocolHandler( |
| 169 blob_storage_context->controller(), | 171 blob_storage_context->controller(), |
| 172 file_system_context, |
| 170 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | 173 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); |
| 171 DCHECK(set_protocol); | 174 DCHECK(set_protocol); |
| 172 set_protocol = job_factory->SetProtocolHandler( | 175 set_protocol = job_factory->SetProtocolHandler( |
| 173 chrome::kFileSystemScheme, | 176 chrome::kFileSystemScheme, |
| 174 CreateFileSystemProtocolHandler(file_system_context)); | 177 CreateFileSystemProtocolHandler(file_system_context)); |
| 175 DCHECK(set_protocol); | 178 DCHECK(set_protocol); |
| 176 | 179 |
| 177 job_factory->AddInterceptor( | 180 job_factory->AddInterceptor( |
| 178 new DeveloperProtocolHandler(appcache_service, | 181 new DeveloperProtocolHandler(appcache_service, |
| 179 blob_storage_context->controller())); | 182 blob_storage_context->controller())); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 272 |
| 270 // We do not call InitializeURLRequestContext() for media contexts because, | 273 // We do not call InitializeURLRequestContext() for media contexts because, |
| 271 // other than the HTTP cache, the media contexts share the same backing | 274 // other than the HTTP cache, the media contexts share the same backing |
| 272 // objects as their associated "normal" request context. Thus, the previous | 275 // objects as their associated "normal" request context. Thus, the previous |
| 273 // call serves to initialize the media request context for this storage | 276 // call serves to initialize the media request context for this storage |
| 274 // partition as well. | 277 // partition as well. |
| 275 } | 278 } |
| 276 } | 279 } |
| 277 | 280 |
| 278 } // namespace content | 281 } // namespace content |
| OLD | NEW |