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