| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 | 314 |
| 315 if (!info->allow_download()) | 315 if (!info->allow_download()) |
| 316 return true; | 316 return true; |
| 317 | 317 |
| 318 bool must_download = MustDownload(); | 318 bool must_download = MustDownload(); |
| 319 if (!must_download) { | 319 if (!must_download) { |
| 320 if (net::IsSupportedMimeType(mime_type)) | 320 if (net::IsSupportedMimeType(mime_type)) |
| 321 return true; | 321 return true; |
| 322 | 322 |
| 323 #if defined(ENABLE_PLUGINS) |
| 323 bool stale; | 324 bool stale; |
| 324 bool has_plugin = HasSupportingPlugin(&stale); | 325 bool has_plugin = HasSupportingPlugin(&stale); |
| 325 if (stale) { | 326 if (stale) { |
| 326 // Refresh the plugins asynchronously. | 327 // Refresh the plugins asynchronously. |
| 327 PluginServiceImpl::GetInstance()->GetPlugins( | 328 PluginServiceImpl::GetInstance()->GetPlugins( |
| 328 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, | 329 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, |
| 329 weak_ptr_factory_.GetWeakPtr())); | 330 weak_ptr_factory_.GetWeakPtr())); |
| 330 *defer = true; | 331 *defer = true; |
| 331 return true; | 332 return true; |
| 332 } | 333 } |
| 333 if (has_plugin) | 334 if (has_plugin) |
| 334 return true; | 335 return true; |
| 336 #endif |
| 335 } | 337 } |
| 336 | 338 |
| 337 // Install download handler | 339 // Install download handler |
| 338 info->set_is_download(true); | 340 info->set_is_download(true); |
| 339 scoped_ptr<ResourceHandler> handler( | 341 scoped_ptr<ResourceHandler> handler( |
| 340 host_->CreateResourceHandlerForDownload( | 342 host_->CreateResourceHandlerForDownload( |
| 341 request_, | 343 request_, |
| 342 true, // is_content_initiated | 344 true, // is_content_initiated |
| 343 must_download, | 345 must_download, |
| 344 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), | 346 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 const std::vector<webkit::WebPluginInfo>& plugins) { | 457 const std::vector<webkit::WebPluginInfo>& plugins) { |
| 456 bool defer = false; | 458 bool defer = false; |
| 457 if (!ProcessResponse(&defer)) { | 459 if (!ProcessResponse(&defer)) { |
| 458 controller()->Cancel(); | 460 controller()->Cancel(); |
| 459 } else if (!defer) { | 461 } else if (!defer) { |
| 460 controller()->Resume(); | 462 controller()->Resume(); |
| 461 } | 463 } |
| 462 } | 464 } |
| 463 | 465 |
| 464 } // namespace content | 466 } // namespace content |
| OLD | NEW |