| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return UseAlternateNextHandler(handler.Pass()); | 326 return UseAlternateNextHandler(handler.Pass()); |
| 327 | 327 |
| 328 #if defined(ENABLE_PLUGINS) | 328 #if defined(ENABLE_PLUGINS) |
| 329 bool stale; | 329 bool stale; |
| 330 bool has_plugin = HasSupportingPlugin(&stale); | 330 bool has_plugin = HasSupportingPlugin(&stale); |
| 331 if (stale) { | 331 if (stale) { |
| 332 // Refresh the plugins asynchronously. | 332 // Refresh the plugins asynchronously. |
| 333 PluginServiceImpl::GetInstance()->GetPlugins( | 333 PluginServiceImpl::GetInstance()->GetPlugins( |
| 334 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, | 334 base::Bind(&BufferedResourceHandler::OnPluginsLoaded, |
| 335 weak_ptr_factory_.GetWeakPtr())); | 335 weak_ptr_factory_.GetWeakPtr())); |
| 336 request()->LogBlockedBy("BufferedResourceHandler"); |
| 336 *defer = true; | 337 *defer = true; |
| 337 return true; | 338 return true; |
| 338 } | 339 } |
| 339 if (has_plugin) | 340 if (has_plugin) |
| 340 return true; | 341 return true; |
| 341 #endif | 342 #endif |
| 342 } | 343 } |
| 343 | 344 |
| 344 // Install download handler | 345 // Install download handler |
| 345 info->set_is_download(true); | 346 info->set_is_download(true); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_)) | 464 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_)) |
| 464 return false; | 465 return false; |
| 465 | 466 |
| 466 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); | 467 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); |
| 467 memcpy(buf->data(), read_buffer_->data(), bytes_read_); | 468 memcpy(buf->data(), read_buffer_->data(), bytes_read_); |
| 468 return true; | 469 return true; |
| 469 } | 470 } |
| 470 | 471 |
| 471 void BufferedResourceHandler::OnPluginsLoaded( | 472 void BufferedResourceHandler::OnPluginsLoaded( |
| 472 const std::vector<WebPluginInfo>& plugins) { | 473 const std::vector<WebPluginInfo>& plugins) { |
| 474 request()->LogUnblocked(); |
| 473 bool defer = false; | 475 bool defer = false; |
| 474 if (!ProcessResponse(&defer)) { | 476 if (!ProcessResponse(&defer)) { |
| 475 controller()->Cancel(); | 477 controller()->Cancel(); |
| 476 } else if (!defer) { | 478 } else if (!defer) { |
| 477 controller()->Resume(); | 479 controller()->Resume(); |
| 478 } | 480 } |
| 479 } | 481 } |
| 480 | 482 |
| 481 } // namespace content | 483 } // namespace content |
| OLD | NEW |