Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: chrome/browser/renderer_host/download_throttling_resource_handler.cc

Issue 6459005: Cancel prerender when we discover a download starting from a page we are prer... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Moved notification to ctor and added notification for manual downloads Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
@@ -6,11 +6,27 @@
#include "base/logging.h"
#include "chrome/browser/renderer_host/download_resource_handler.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.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) {
+ 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
Randy Smith (Not in Mondays) 2011/02/13 03:08:36 Is dislike duplicating this code; is there anywher
dominich 2011/02/14 16:07:12 I do want to keep it generic as I can see this bei
+
DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler(
ResourceDispatcherHost* host,
net::URLRequest* request,
@@ -31,7 +47,11 @@
host_->PauseRequest(render_process_host_id_, request_id_, true);
host_->download_request_limiter()->CanDownloadOnIOThread(
render_process_host_id_, render_view_id, this);
- }
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&NotifyOnUI, NotificationType::DOWNLOAD_INITIATED,
+ render_process_host_id_, render_view_id_));
+}
DownloadThrottlingResourceHandler::~DownloadThrottlingResourceHandler() {
}

Powered by Google App Engine
This is Rietveld 408576698