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 // info->allow_download() == true implies | |
316 // info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME or | |
317 // info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME. | |
318 if (info->allow_download()) { | |
319 DCHECK(info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME || | |
320 info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME); | |
mmenke
2014/11/18 16:32:17
Can move this down below the "!info->allow_downloa
raymes
2014/11/19 04:08:37
Done.
| |
321 } | |
322 | |
323 // Allow requests for object/embed tags to be intercepted as streams. | |
324 if (info->GetResourceType() == content::RESOURCE_TYPE_OBJECT) { | |
325 DCHECK(!info->allow_download()); | |
326 DCHECK(!net::IsSupportedMimeType(mime_type)); | |
mmenke
2014/11/18 16:32:17
In addition to never getting intercepted as stream
raymes
2014/11/19 04:08:37
Arg no that's not necessarily true. I had already
| |
327 std::string payload; | |
328 scoped_ptr<ResourceHandler> handler( | |
329 host_->MaybeInterceptAsStream(request(), response_.get(), &payload)); | |
330 if (handler) { | |
331 return UseAlternateNextHandler(handler.Pass(), payload); | |
332 } | |
333 } | |
334 | |
315 if (!info->allow_download()) | 335 if (!info->allow_download()) |
316 return true; | 336 return true; |
317 | 337 |
318 bool must_download = MustDownload(); | 338 bool must_download = MustDownload(); |
319 if (!must_download) { | 339 if (!must_download) { |
320 if (net::IsSupportedMimeType(mime_type)) | 340 if (net::IsSupportedMimeType(mime_type)) |
321 return true; | 341 return true; |
322 | 342 |
323 std::string payload; | 343 std::string payload; |
324 scoped_ptr<ResourceHandler> handler( | 344 scoped_ptr<ResourceHandler> handler( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 request()->LogUnblocked(); | 514 request()->LogUnblocked(); |
495 bool defer = false; | 515 bool defer = false; |
496 if (!ProcessResponse(&defer)) { | 516 if (!ProcessResponse(&defer)) { |
497 controller()->Cancel(); | 517 controller()->Cancel(); |
498 } else if (!defer) { | 518 } else if (!defer) { |
499 controller()->Resume(); | 519 controller()->Resume(); |
500 } | 520 } |
501 } | 521 } |
502 | 522 |
503 } // namespace content | 523 } // namespace content |
OLD | NEW |