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| |