Chromium Code Reviews| Index: chrome/browser/renderer_host/download_throttling_resource_handler.cc |
| =================================================================== |
| --- chrome/browser/renderer_host/download_throttling_resource_handler.cc (revision 74377) |
| +++ chrome/browser/renderer_host/download_throttling_resource_handler.cc (working copy) |
| @@ -5,12 +5,33 @@ |
| #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" |
| #include "base/logging.h" |
| +#include "chrome/browser/cert_store.h" |
|
cbentzel
2011/02/10 14:44:34
A bunch of these includes are not needed:
cert_st
dominich
2011/02/10 18:46:22
Done.
|
| #include "chrome/browser/renderer_host/download_resource_handler.h" |
| +#include "chrome/browser/renderer_host/render_view_host.h" |
| +#include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| +#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| +#include "chrome/browser/renderer_host/resource_request_details.h" |
| +#include "chrome/common/notification_service.h" |
| #include "chrome/common/resource_response.h" |
| #include "net/base/io_buffer.h" |
| #include "net/base/mime_sniffer.h" |
| +namespace { |
| + |
| +void NotifyOnUI(NotificationType::Type notification_type, |
| + int process_id, int view_id) { |
| + RenderViewHost* rvh = RenderViewHost::FromID(process_id, view_id); |
|
cbentzel
2011/02/10 14:44:34
You should probably DCHECK that this is called on
cbentzel
2011/02/10 14:44:34
Do you want to DCHECK that the notification_type i
dominich
2011/02/10 18:46:22
Done.
dominich
2011/02/10 18:46:22
I can, but given this is local to the file and is
|
| + if (rvh) { |
|
cbentzel
2011/02/10 14:44:34
You can also do
if (!rvh)
return;
to minimize
|
| + RenderViewHostDelegate* rvhd = rvh->delegate(); |
| + NotificationService::current()->Notify(notification_type, |
| + Source<RenderViewHostDelegate>(rvhd), |
|
cbentzel
2011/02/10 14:44:34
This certainly simplifies things for prerender, bu
Randy Smith (Not in Mondays)
2011/02/10 16:57:10
I would agree with this comment, and unless it rea
dominich
2011/02/10 18:46:22
Done.
|
| + NotificationService::NoDetails()); |
| + } |
| +} |
| + |
| +} |
|
cbentzel
2011/02/10 14:44:34
Nit: add // namespace to make it clear what this b
|
| + |
| DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
| ResourceDispatcherHost* host, |
| net::URLRequest* request, |
| @@ -60,6 +81,11 @@ |
| bool DownloadThrottlingResourceHandler::OnResponseStarted( |
| int request_id, |
| ResourceResponse* response) { |
| + BrowserThread::PostTask( |
|
cbentzel
2011/02/10 14:44:34
I thought this was going to move into DownloadReso
Randy Smith (Not in Mondays)
2011/02/10 16:57:10
We never get to DownloadResourceHandler, so he can
|
| + BrowserThread::UI, FROM_HERE, |
| + NewRunnableFunction(&NotifyOnUI, NotificationType::DOWNLOAD_INITIATED, |
| + render_process_host_id_, render_view_id_)); |
| + |
| if (download_handler_.get()) |
| return download_handler_->OnResponseStarted(request_id, response); |
| response_ = response; |