| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return true; | 316 return true; |
| 317 | 317 |
| 318 if (!MustDownload()) { | 318 if (!MustDownload()) { |
| 319 if (net::IsSupportedMimeType(mime_type)) | 319 if (net::IsSupportedMimeType(mime_type)) |
| 320 return true; | 320 return true; |
| 321 | 321 |
| 322 bool stale; | 322 bool stale; |
| 323 bool has_plugin = HasSupportingPlugin(&stale); | 323 bool has_plugin = HasSupportingPlugin(&stale); |
| 324 if (stale) { | 324 if (stale) { |
| 325 // Refresh the plugins asynchronously. | 325 // Refresh the plugins asynchronously. |
| 326 PluginServiceImpl::GetInstance()->GetPlugins( | 326 PluginService::GetInstance()->GetPlugins( |
| 327 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, | 327 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, |
| 328 weak_ptr_factory_.GetWeakPtr())); | 328 weak_ptr_factory_.GetWeakPtr())); |
| 329 *defer = true; | 329 *defer = true; |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 if (has_plugin) | 332 if (has_plugin) |
| 333 return true; | 333 return true; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // Install download handler | 336 // Install download handler |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 422 } |
| 423 | 423 |
| 424 return must_download_; | 424 return must_download_; |
| 425 } | 425 } |
| 426 | 426 |
| 427 bool BufferedResourceHandler::HasSupportingPlugin(bool* stale) { | 427 bool BufferedResourceHandler::HasSupportingPlugin(bool* stale) { |
| 428 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request_); | 428 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request_); |
| 429 | 429 |
| 430 bool allow_wildcard = false; | 430 bool allow_wildcard = false; |
| 431 webkit::WebPluginInfo plugin; | 431 webkit::WebPluginInfo plugin; |
| 432 return PluginServiceImpl::GetInstance()->GetPluginInfo( | 432 return PluginService::GetInstance()->GetPluginInfo( |
| 433 info->GetChildID(), info->GetRouteID(), info->GetContext(), | 433 info->GetChildID(), info->GetRouteID(), info->GetContext(), |
| 434 request_->url(), GURL(), response_->head.mime_type, allow_wildcard, | 434 request_->url(), GURL(), response_->head.mime_type, allow_wildcard, |
| 435 stale, &plugin, NULL); | 435 stale, &plugin, NULL); |
| 436 } | 436 } |
| 437 | 437 |
| 438 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { | 438 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { |
| 439 if (!bytes_read_) | 439 if (!bytes_read_) |
| 440 return true; | 440 return true; |
| 441 | 441 |
| 442 net::IOBuffer* buf = NULL; | 442 net::IOBuffer* buf = NULL; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 453 const std::vector<webkit::WebPluginInfo>& plugins) { | 453 const std::vector<webkit::WebPluginInfo>& plugins) { |
| 454 bool defer = false; | 454 bool defer = false; |
| 455 if (!ProcessResponse(&defer)) { | 455 if (!ProcessResponse(&defer)) { |
| 456 controller()->Cancel(); | 456 controller()->Cancel(); |
| 457 } else if (!defer) { | 457 } else if (!defer) { |
| 458 controller()->Resume(); | 458 controller()->Resume(); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace content | 462 } // namespace content |
| OLD | NEW |