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/mime_type_resource_handler.h" | 5 #include "content/browser/loader/mime_type_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/location.h" | 10 #include "base/location.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 #endif | 334 #endif |
| 335 return true; | 335 return true; |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool MimeTypeResourceHandler::SelectNextHandler(bool* defer) { | 338 bool MimeTypeResourceHandler::SelectNextHandler(bool* defer) { |
| 339 DCHECK(!response_->head.mime_type.empty()); | 339 DCHECK(!response_->head.mime_type.empty()); |
| 340 | 340 |
| 341 ResourceRequestInfoImpl* info = GetRequestInfo(); | 341 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 342 const std::string& mime_type = response_->head.mime_type; | 342 const std::string& mime_type = response_->head.mime_type; |
| 343 | 343 |
| 344 #if defined(OS_ANDROID) | |
| 344 if (mime_util::IsSupportedCertificateMimeType(mime_type)) { | 345 if (mime_util::IsSupportedCertificateMimeType(mime_type)) { |
| 345 // Install certificate file. | 346 // Install certificate file. |
| 346 info->set_is_download(true); | 347 info->set_is_download(true); |
| 347 scoped_ptr<ResourceHandler> handler( | 348 scoped_ptr<ResourceHandler> handler( |
| 348 new CertificateResourceHandler(request())); | 349 new CertificateResourceHandler(request())); |
| 349 return UseAlternateNextHandler(handler.Pass(), std::string()); | 350 return UseAlternateNextHandler(handler.Pass(), std::string()); |
| 350 } | 351 } |
| 352 #endif | |
|
Ryan Sleevi
2015/10/30 23:33:47
We should be able to delete this code; the intent
svaldez
2015/11/02 16:27:38
Acknowledged.
| |
| 351 | 353 |
| 352 // Allow requests for object/embed tags to be intercepted as streams. | 354 // Allow requests for object/embed tags to be intercepted as streams. |
| 353 if (info->GetResourceType() == content::RESOURCE_TYPE_OBJECT) { | 355 if (info->GetResourceType() == content::RESOURCE_TYPE_OBJECT) { |
| 354 DCHECK(!info->allow_download()); | 356 DCHECK(!info->allow_download()); |
| 355 | 357 |
| 356 bool handled_by_plugin; | 358 bool handled_by_plugin; |
| 357 if (!SelectPluginHandler(defer, &handled_by_plugin)) | 359 if (!SelectPluginHandler(defer, &handled_by_plugin)) |
| 358 return false; | 360 return false; |
| 359 if (handled_by_plugin || *defer) | 361 if (handled_by_plugin || *defer) |
| 360 return true; | 362 return true; |
| 361 } | 363 } |
| 362 | 364 |
| 363 if (!info->allow_download()) | 365 if (!info->allow_download()) |
| 364 return true; | 366 return true; |
| 365 | 367 |
| 366 // info->allow_download() == true implies | 368 // info->allow_download() == true implies |
| 367 // info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME or | 369 // info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME or |
| 368 // info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME. | 370 // info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME. |
| 369 DCHECK(info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME || | 371 DCHECK(info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME || |
| 370 info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME); | 372 info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME); |
| 371 | 373 |
| 372 bool must_download = MustDownload(); | 374 bool must_download = MustDownload(); |
| 373 if (!must_download) { | 375 if (!must_download) { |
| 374 if (mime_util::IsSupportedMimeType(mime_type)) | 376 if (mime_util::IsSupportedMimeType(mime_type) && |
| 377 !mime_util::IsSupportedCertificateMimeType(mime_type)) { | |
| 375 return true; | 378 return true; |
| 379 } | |
| 376 | 380 |
| 377 bool handled_by_plugin; | 381 bool handled_by_plugin; |
| 378 if (!SelectPluginHandler(defer, &handled_by_plugin)) | 382 if (!SelectPluginHandler(defer, &handled_by_plugin)) |
| 379 return false; | 383 return false; |
| 380 if (handled_by_plugin || *defer) | 384 if (handled_by_plugin || *defer) |
| 381 return true; | 385 return true; |
| 382 } | 386 } |
| 383 | 387 |
| 384 // Install download handler | 388 // Install download handler |
| 385 info->set_is_download(true); | 389 info->set_is_download(true); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 request()->LogUnblocked(); | 518 request()->LogUnblocked(); |
| 515 bool defer = false; | 519 bool defer = false; |
| 516 if (!ProcessResponse(&defer)) { | 520 if (!ProcessResponse(&defer)) { |
| 517 controller()->Cancel(); | 521 controller()->Cancel(); |
| 518 } else if (!defer) { | 522 } else if (!defer) { |
| 519 controller()->Resume(); | 523 controller()->Resume(); |
| 520 } | 524 } |
| 521 } | 525 } |
| 522 | 526 |
| 523 } // namespace content | 527 } // namespace content |
| OLD | NEW |