Chromium Code Reviews| Index: chrome/browser/renderer_host/download_resource_handler.cc |
| =================================================================== |
| --- chrome/browser/renderer_host/download_resource_handler.cc (revision 74377) |
| +++ chrome/browser/renderer_host/download_resource_handler.cc (working copy) |
| @@ -15,13 +15,29 @@ |
| #include "chrome/browser/download/download_file_manager.h" |
| #include "chrome/browser/history/download_create_info.h" |
| #include "chrome/browser/renderer_host/global_request_id.h" |
| +#include "chrome/browser/renderer_host/render_view_host.h" |
| #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| +#include "chrome/common/notification_service.h" |
| #include "chrome/common/resource_response.h" |
| #include "net/base/io_buffer.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/url_request/url_request_context.h" |
| +namespace { |
| +void NotifyOnUI(NotificationType::Type notification_type, |
| + int process_id, int view_id) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + RenderViewHost* rvh = RenderViewHost::FromID(process_id, view_id); |
| + if (!rvh) |
| + return; |
| + |
| + NotificationService::current()->Notify(notification_type, |
| + Source<RenderViewHost>(rvh), |
| + NotificationService::NoDetails()); |
| +} |
| +} // namespace |
| + |
| DownloadResourceHandler::DownloadResourceHandler( |
| ResourceDispatcherHost* rdh, |
| int render_process_host_id, |
| @@ -46,6 +62,10 @@ |
| rdh_(rdh), |
| is_paused_(false), |
| url_check_pending_(false) { |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, |
| + NewRunnableFunction(&NotifyOnUI, NotificationType::DOWNLOAD_INITIATED, |
| + render_process_host_id, render_view_id_)); |
|
Randy Smith (Not in Mondays)
2011/02/13 03:08:36
I'd rather not notify from the DownloadResourceHan
dominich
2011/02/14 16:07:12
I was considering download_util::DownloadUrl as an
Randy Smith (Not in Mondays)
2011/02/14 19:20:51
Neither one's particularly future-proof, I'm afrai
|
| } |
| bool DownloadResourceHandler::OnUploadProgress(int request_id, |