Chromium Code Reviews| 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/loader/buffered_resource_handler.h" | 5 #include "content/browser/loader/buffered_resource_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 const std::string& mime_type = response_->head.mime_type; | 305 const std::string& mime_type = response_->head.mime_type; |
| 306 | 306 |
| 307 if (net::IsSupportedCertificateMimeType(mime_type)) { | 307 if (net::IsSupportedCertificateMimeType(mime_type)) { |
| 308 // Install certificate file. | 308 // Install certificate file. |
| 309 info->set_is_download(true); | 309 info->set_is_download(true); |
| 310 scoped_ptr<ResourceHandler> handler( | 310 scoped_ptr<ResourceHandler> handler( |
| 311 new CertificateResourceHandler(request())); | 311 new CertificateResourceHandler(request())); |
| 312 return UseAlternateNextHandler(handler.Pass(), std::string()); | 312 return UseAlternateNextHandler(handler.Pass(), std::string()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 // Allow requests for object/embed tags to be intercepted as streams. | |
| 316 if (info->GetResourceType() == content::RESOURCE_TYPE_OBJECT) { | |
| 317 DCHECK(!info->allow_download()); | |
| 318 std::string payload; | |
| 319 scoped_ptr<ResourceHandler> handler( | |
| 320 host_->MaybeInterceptAsStream(request(), response_.get(), &payload)); | |
|
mmenke
2014/11/17 18:57:08
The other call to this is bypassed if "net::IsSupp
raymes
2014/11/17 23:44:25
Requests for those types should never get intercep
| |
| 321 if (handler) { | |
| 322 return UseAlternateNextHandler(handler.Pass(), payload); | |
| 323 } | |
| 324 } | |
| 325 | |
| 315 if (!info->allow_download()) | 326 if (!info->allow_download()) |
| 316 return true; | 327 return true; |
| 317 | 328 |
| 318 bool must_download = MustDownload(); | 329 bool must_download = MustDownload(); |
| 319 if (!must_download) { | 330 if (!must_download) { |
| 320 if (net::IsSupportedMimeType(mime_type)) | 331 if (net::IsSupportedMimeType(mime_type)) |
| 321 return true; | 332 return true; |
| 322 | 333 |
| 323 std::string payload; | 334 std::string payload; |
| 324 scoped_ptr<ResourceHandler> handler( | 335 scoped_ptr<ResourceHandler> handler( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 request()->LogUnblocked(); | 505 request()->LogUnblocked(); |
| 495 bool defer = false; | 506 bool defer = false; |
| 496 if (!ProcessResponse(&defer)) { | 507 if (!ProcessResponse(&defer)) { |
| 497 controller()->Cancel(); | 508 controller()->Cancel(); |
| 498 } else if (!defer) { | 509 } else if (!defer) { |
| 499 controller()->Resume(); | 510 controller()->Resume(); |
| 500 } | 511 } |
| 501 } | 512 } |
| 502 | 513 |
| 503 } // namespace content | 514 } // namespace content |
| OLD | NEW |