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 "chrome/browser/extensions/extension_protocols.h" | 5 #include "chrome/browser/extensions/extension_protocols.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 scoped_refptr<const Extension> extension_; | 151 scoped_refptr<const Extension> extension_; |
152 net::HttpResponseInfo response_info_; | 152 net::HttpResponseInfo response_info_; |
153 }; | 153 }; |
154 | 154 |
155 class URLRequestExtensionJob : public net::URLRequestFileJob { | 155 class URLRequestExtensionJob : public net::URLRequestFileJob { |
156 public: | 156 public: |
157 URLRequestExtensionJob(net::URLRequest* request, | 157 URLRequestExtensionJob(net::URLRequest* request, |
158 const FilePath& filename, | 158 const FilePath& filename, |
159 const std::string& content_security_policy, | 159 const std::string& content_security_policy, |
160 bool send_cors_header) | 160 bool send_cors_header, |
161 : net::URLRequestFileJob(request, filename) { | 161 net::NetworkDelegate* network_delegate) |
| 162 : net::URLRequestFileJob(request, filename, network_delegate) { |
162 response_info_.headers = BuildHttpHeaders(content_security_policy, | 163 response_info_.headers = BuildHttpHeaders(content_security_policy, |
163 send_cors_header); | 164 send_cors_header); |
164 } | 165 } |
165 | 166 |
166 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE { | 167 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE { |
167 *info = response_info_; | 168 *info = response_info_; |
168 } | 169 } |
169 | 170 |
170 private: | 171 private: |
171 virtual ~URLRequestExtensionJob() {} | 172 virtual ~URLRequestExtensionJob() {} |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 332 |
332 FilePath resource_file_path; | 333 FilePath resource_file_path; |
333 { | 334 { |
334 // Getting the file path will touch the file system. Fixing | 335 // Getting the file path will touch the file system. Fixing |
335 // crbug.com/59849 would also fix this. Suppress the error for now. | 336 // crbug.com/59849 would also fix this. Suppress the error for now. |
336 base::ThreadRestrictions::ScopedAllowIO allow_io; | 337 base::ThreadRestrictions::ScopedAllowIO allow_io; |
337 resource_file_path = resource.GetFilePath(); | 338 resource_file_path = resource.GetFilePath(); |
338 } | 339 } |
339 | 340 |
340 return new URLRequestExtensionJob(request, resource_file_path, | 341 return new URLRequestExtensionJob(request, resource_file_path, |
341 content_security_policy, send_cors_header); | 342 content_security_policy, send_cors_header, |
| 343 request->context()->network_delegate()); |
342 } | 344 } |
343 | 345 |
344 } // namespace | 346 } // namespace |
345 | 347 |
346 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 348 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
347 bool is_incognito, | 349 bool is_incognito, |
348 ExtensionInfoMap* extension_info_map) { | 350 ExtensionInfoMap* extension_info_map) { |
349 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 351 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
350 } | 352 } |
OLD | NEW |