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

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"
@@ -1566,15 +1567,15 @@
// Notify the observers on the IO thread.
FOR_EACH_OBSERVER(Observer, observer_list_, OnRequestStarted(this, request));
- int render_process_id, render_view_id;
- if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
- 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,
+ detail));
}
void ResourceDispatcherHost::NotifyResponseCompleted(net::URLRequest* request,
@@ -1591,17 +1592,24 @@
FOR_EACH_OBSERVER(Observer, observer_list_,
OnReceivedRedirect(this, request, new_url));
- int render_process_id, render_view_id;
- if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
- 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,
+ detail));
}
+template <class T>
+void ResourceDispatcherHost::NotifyOnUI(NotificationType type, T* detail) {
+ NotificationService::current()->Notify(
+ type, NotificationService::AllSources(), Details<T>(detail));
brettw 2010/12/29 20:20:34 The documentation on the Source for the notificati
jam 2010/12/29 21:52:47 i was on the fence about this, but you convinced m
brettw 2010/12/29 22:19:19 The problem with this solution is that renderer_ho
jam 2010/12/29 23:39:46 ah, got it. done
+ delete detail;
+}
+
namespace {
// This function attempts to return the "more interesting" load state of |a|

Powered by Google App Engine
This is Rietveld 408576698