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

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

Issue 7664019: Move download UMA functions to their own file in content. Also fire the chrome-only notification ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/chrome_resource_dispatcher_host_delegate.cc
===================================================================
--- chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc (revision 96993)
+++ chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc (working copy)
@@ -19,13 +19,16 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/autologin_infobar_delegate.h"
#include "chrome/browser/ui/login/login_prompt.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/render_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/resource_context.h"
+#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/renderer_host/resource_message_filter.h"
+#include "content/common/notification_service.h"
#include "content/common/resource_messages.h"
#include "net/base/load_flags.h"
@@ -53,6 +56,17 @@
referrer);
}
+void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) {
+ RenderViewHost* rvh = RenderViewHost::FromID(render_process_id,
+ render_view_id);
+ if (!rvh)
+ return;
+
+ NotificationService::current()->Notify(
+ chrome::NOTIFICATION_DOWNLOAD_INITIATED, Source<RenderViewHost>(rvh),
+ NotificationService::NoDetails());
+}
+
} // end namespace
ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate(
@@ -155,6 +169,10 @@
bool is_new_request,
bool in_complete) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&NotifyDownloadInitiatedOnUI, child_id, route_id));
+
// If this isn't a new request, we've seen this before and added the safe
// browsing resource handler already so no need to add it again. This code
// path is only hit for requests initiated through the browser, and not the

Powered by Google App Engine
This is Rietveld 408576698