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) { | |
|
Zachary Kuznia
2014/11/13 23:18:08
Why isn't this caught by line 333?
raymes
2014/11/13 23:42:10
Because in these cases |allow_download| is always
Zachary Kuznia
2014/11/13 23:48:42
It feels like we should share this call with the o
raymes
2014/11/14 20:55:29
I did try to share the code in a few different way
Zachary Kuznia
2014/11/14 22:01:45
Fair enough, I thought that might be the case.
| |
| 317 DCHECK(!info->allow_download()); | |
| 318 std::string payload; | |
| 319 scoped_ptr<ResourceHandler> handler( | |
| 320 host_->MaybeInterceptAsStream(request(), response_.get(), &payload)); | |
| 321 return UseAlternateNextHandler(handler.Pass(), payload); | |
|
Zachary Kuznia
2014/11/13 23:18:08
Is there a reason not to test that handler is set?
raymes
2014/11/13 23:42:10
There is one other place where requests are made o
Zachary Kuznia
2014/11/13 23:48:42
In that case, shouldn't we maintain the current be
raymes
2014/11/14 20:55:29
Yes, good catch! I added a test for this.
| |
| 322 } | |
| 323 | |
| 315 if (!info->allow_download()) | 324 if (!info->allow_download()) |
| 316 return true; | 325 return true; |
| 317 | 326 |
| 318 bool must_download = MustDownload(); | 327 bool must_download = MustDownload(); |
| 319 if (!must_download) { | 328 if (!must_download) { |
| 320 if (net::IsSupportedMimeType(mime_type)) | 329 if (net::IsSupportedMimeType(mime_type)) |
| 321 return true; | 330 return true; |
| 322 | 331 |
| 323 std::string payload; | 332 std::string payload; |
| 324 scoped_ptr<ResourceHandler> handler( | 333 scoped_ptr<ResourceHandler> handler( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 request()->LogUnblocked(); | 503 request()->LogUnblocked(); |
| 495 bool defer = false; | 504 bool defer = false; |
| 496 if (!ProcessResponse(&defer)) { | 505 if (!ProcessResponse(&defer)) { |
| 497 controller()->Cancel(); | 506 controller()->Cancel(); |
| 498 } else if (!defer) { | 507 } else if (!defer) { |
| 499 controller()->Resume(); | 508 controller()->Resume(); |
| 500 } | 509 } |
| 501 } | 510 } |
| 502 | 511 |
| 503 } // namespace content | 512 } // namespace content |
| OLD | NEW |