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

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

Issue 6025009: Get rid of RenderViewHostDelegate::Resource and dispatch the IPC messages dir... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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/resource_dispatcher_host.cc
===================================================================
--- chrome/browser/renderer_host/resource_dispatcher_host.cc (revision 70223)
+++ chrome/browser/renderer_host/resource_dispatcher_host.cc (working copy)
@@ -54,6 +54,7 @@
#include "chrome/browser/ui/login/login_prompt.h"
#include "chrome/browser/worker_host/worker_service.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/url_constants.h"
@@ -1571,10 +1572,14 @@
return;
// Notify the observers on the UI thread.
- CallRenderViewHostResourceDelegate(
- render_process_id, render_view_id,
- &RenderViewHostDelegate::Resource::DidStartReceivingResourceResponse,
- ResourceRequestDetails(request, GetCertID(request, child_id)));
+ ResourceRequestDetails* detail = new ResourceRequestDetails(
+ request, GetCertID(request, child_id));
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(
+ &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>,
+ NotificationType::RESOURCE_RESPONSE_STARTED,
+ render_process_id, render_view_id, detail));
}
void ResourceDispatcherHost::NotifyResponseCompleted(net::URLRequest* request,
@@ -1596,12 +1601,31 @@
return;
// Notify the observers on the UI thread.
- CallRenderViewHostResourceDelegate(
- render_process_id, render_view_id,
- &RenderViewHostDelegate::Resource::DidRedirectResource,
- ResourceRedirectDetails(request, GetCertID(request, child_id), new_url));
+ ResourceRedirectDetails* detail = new ResourceRedirectDetails(
+ request, GetCertID(request, child_id), new_url);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(
+ &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>,
+ NotificationType::RESOURCE_RECEIVED_REDIRECT,
+ render_process_id, render_view_id, detail));
}
+template <class T>
+void ResourceDispatcherHost::NotifyOnUI(NotificationType type,
+ int render_process_id,
+ int render_view_id,
+ T* detail) {
+ RenderViewHost* rvh =
+ RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!rvh)
+ return;
+ RenderViewHostDelegate* rvhd = rvh->delegate();
+ NotificationService::current()->Notify(
+ type, Source<RenderViewHostDelegate>(rvhd), Details<T>(detail));
+ delete detail;
+}
+
namespace {
// This function attempts to return the "more interesting" load state of |a|
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | chrome/browser/renderer_host/resource_request_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698