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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 23947003: Create WebContentsObserver callbacks for notifications, remove notifications from SSLManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 7 years, 3 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 2a4ad9ac684eaf013e8717688027dc894c13aa1b..07d88b18ad3bd5a68d8d8ebb384fcb30245f2e26 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -58,7 +58,6 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_url_parameters.h"
#include "content/public/browser/global_request_id.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/resource_dispatcher_host_delegate.h"
#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/resource_throttle.h"
@@ -266,17 +265,28 @@ int GetCertID(net::URLRequest* request, int child_id) {
return 0;
}
-template <class T>
-void NotifyOnUI(int type, int render_process_id, int render_view_id,
- scoped_ptr<T> detail) {
+void NotifyRedirectOnUI(int render_process_id,
+ int render_view_id,
+ scoped_ptr<ResourceRedirectDetails> details) {
RenderViewHostImpl* host =
RenderViewHostImpl::FromID(render_process_id, render_view_id);
- if (host) {
- RenderViewHostDelegate* delegate = host->GetDelegate();
- NotificationService::current()->Notify(
- type, Source<WebContents>(delegate->GetAsWebContents()),
- Details<T>(detail.get()));
- }
+ if (!host)
+ return;
+
+ RenderViewHostDelegate* delegate = host->GetDelegate();
+ delegate->DidGetRedirectForResourceRequest(*details.get());
+}
+
+void NotifyResponseOnUI(int render_process_id,
+ int render_view_id,
+ scoped_ptr<ResourceRequestDetails> details) {
+ RenderViewHostImpl* host =
+ RenderViewHostImpl::FromID(render_process_id, render_view_id);
+ if (!host)
+ return;
+
+ RenderViewHostDelegate* delegate = host->GetDelegate();
+ delegate->DidGetResourceResponseStart(*details.get());
}
} // namespace
@@ -681,8 +691,7 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader,
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(
- &NotifyOnUI<ResourceRedirectDetails>,
- static_cast<int>(NOTIFICATION_RESOURCE_RECEIVED_REDIRECT),
+ &NotifyRedirectOnUI,
render_process_id, render_view_id, base::Passed(&detail)));
}
@@ -713,8 +722,7 @@ void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(
- &NotifyOnUI<ResourceRequestDetails>,
- static_cast<int>(NOTIFICATION_RESOURCE_RESPONSE_STARTED),
+ &NotifyResponseOnUI,
render_process_id, render_view_id, base::Passed(&detail)));
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698