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

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

Issue 9406001: Factor out ResourceDispatcherHost dependent code around SSLManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 8 years, 10 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: content/browser/renderer_host/resource_dispatcher_host.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index 3000f502c579d1df846ba96d1fe688e5f2325861..bf2e0c36578421654948719b7be542148840143a 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc
@@ -389,6 +389,62 @@ ResourceDispatcherHost::CreateResourceHandlerForDownload(
return handler;
}
+ResourceType::Type ResourceDispatcherHost::ResourceTypeForInstance(
+ const SSLErrorHandler::instance_id& id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ net::URLRequest* request = GetURLRequest(id);
+ DCHECK(request);
+ ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ DCHECK(info);
+ return info->resource_type();
+}
+
+const GURL& ResourceDispatcherHost::URLForInstance(
+ const SSLErrorHandler::instance_id& id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ net::URLRequest* request = GetURLRequest(id);
+ DCHECK(request);
+ return request->url();
+}
+
+bool ResourceDispatcherHost::RenderViewForInstance(
+ const SSLErrorHandler::instance_id& id,
+ int* render_process_host_id,
+ int* render_view_host_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ return RenderViewForRequest(
+ GetURLRequest(id), render_process_host_id, render_view_host_id);
+}
+
+void ResourceDispatcherHost::CancelRequestForInstance(
+ const SSLErrorHandler::instance_id& id,
+ int error,
+ const net::SSLInfo* ssl_info) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ net::URLRequest* request = GetURLRequest(id);
+ // The request can be NULL if it was cancelled by the renderer (as the
+ // request of the user navigating to a new page from the location bar).
+ if (!request)
+ return;
+ DVLOG(1) << "CancelRequestForInstance() url: " << request->url().spec();
+ if (ssl_info)
+ request->SimulateSSLError(error, *ssl_info);
+ else
+ request->SimulateError(error);
+}
+
+void ResourceDispatcherHost::ContinueRequestForInstance(
+ const SSLErrorHandler::instance_id&id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ net::URLRequest* request = GetURLRequest(id);
+ // The request can be NULL if it was cancelled by the renderer (as the
+ // request of the user navigating to a new page from the location bar).
+ if (!request)
+ return;
+ DVLOG(1) << "ContinueRequestForInstance() url: " << request->url().spec();
+ request->ContinueDespiteLastError();
+}
+
void ResourceDispatcherHost::SetRequestInfo(
net::URLRequest* request,
ResourceDispatcherHostRequestInfo* info) {
@@ -1429,7 +1485,11 @@ void ResourceDispatcherHost::OnSSLCertificateError(
const net::SSLInfo& ssl_info,
bool is_hsts_host) {
DCHECK(request);
- SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host);
+ ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ SSLErrorHandler::instance_id instance;
wtc 2012/02/22 00:36:23 Nit: 'error_handler_id' seems more clear than 'ins
Takashi Toyoshima 2012/02/22 08:15:35 Now, 'request_id' looks better as instance of Glob
+ instance.first = info->child_id();
+ instance.second = info->request_id();
+ SSLManager::OnSSLCertificateError(this, instance, ssl_info, is_hsts_host);
}
bool ResourceDispatcherHost::CanGetCookies(
@@ -1982,6 +2042,14 @@ net::URLRequest* ResourceDispatcherHost::GetURLRequest(
return i->second;
}
+net::URLRequest* ResourceDispatcherHost::GetURLRequest(
+ const SSLErrorHandler::instance_id& id) const {
+ content::GlobalRequestID request_id;
+ request_id.child_id = id.first;
+ request_id.request_id = id.second;
+ return GetURLRequest(request_id);
+}
+
static int GetCertID(net::URLRequest* request, int child_id) {
if (request->ssl_info().cert) {
return CertStore::GetInstance()->StoreCert(request->ssl_info().cert,

Powered by Google App Engine
This is Rietveld 408576698