Chromium Code Reviews| Index: content/browser/ssl/ssl_error_handler.cc |
| diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc |
| index a41ac1bdd3332e9e0bd6d60d00defb7130073bb0..2498adb1997a657a1c81dca03ee4aada4d32eb6b 100644 |
| --- a/content/browser/ssl/ssl_error_handler.cc |
| +++ b/content/browser/ssl/ssl_error_handler.cc |
| @@ -6,7 +6,6 @@ |
| #include "base/bind.h" |
| #include "content/browser/renderer_host/render_view_host.h" |
| -#include "content/browser/renderer_host/resource_dispatcher_host.h" |
| #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
|
Takashi Toyoshima
2012/02/28 21:28:16
Oops, I notice that this inclusion at line 9 also
|
| #include "content/browser/ssl/ssl_cert_error_handler.h" |
| #include "content/browser/tab_contents/navigation_controller_impl.h" |
| @@ -17,26 +16,21 @@ |
| using content::BrowserThread; |
| using content::WebContents; |
| +using net::SSLInfo; |
| -SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHost* rdh, |
| - net::URLRequest* request, |
| - ResourceType::Type resource_type) |
| +SSLErrorHandler::SSLErrorHandler(Delegate* delegate, |
| + const content::GlobalRequestID& id) |
| : manager_(NULL), |
| - request_id_(0, 0), |
| - resource_dispatcher_host_(rdh), |
| - request_url_(request->url()), |
| - resource_type_(resource_type), |
| + request_id_(id), |
| + delegate_(delegate), |
| + request_url_(delegate->URLForSSLRequest(id)), |
| + resource_type_(delegate->ResourceTypeForSSLRequest(id)), |
| request_has_been_notified_(false) { |
| DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + DCHECK(delegate); |
| - ResourceDispatcherHostRequestInfo* info = |
| - ResourceDispatcherHost::InfoForRequest(request); |
| - request_id_.child_id = info->child_id(); |
| - request_id_.request_id = info->request_id(); |
| - |
| - if (!ResourceDispatcherHost::RenderViewForRequest(request, |
| - &render_process_id_, |
| - &render_view_id_)) |
| + if (!delegate->RenderViewForSSLRequest( |
| + id, &render_process_id_, &render_view_id_)) |
| NOTREACHED(); |
| // This makes sure we don't disappear on the IO thread until we've given an |
| @@ -133,18 +127,11 @@ void SSLErrorHandler::CompleteCancelRequest(int error) { |
| if (request_has_been_notified_) |
| return; |
| - net::URLRequest* request = |
| - resource_dispatcher_host_->GetURLRequest(request_id_); |
| - if (request && request->is_pending()) { |
| - // The request can be NULL if it was cancelled by the renderer (as the |
| - // result of the user navigating to a new page from the location bar). |
| - DVLOG(1) << "CompleteCancelRequest() url: " << request->url().spec(); |
| - SSLCertErrorHandler* cert_error = AsSSLCertErrorHandler(); |
| - if (cert_error) |
| - request->SimulateSSLError(error, cert_error->ssl_info()); |
| - else |
| - request->SimulateError(error); |
| - } |
| + SSLCertErrorHandler* cert_error = AsSSLCertErrorHandler(); |
| + const SSLInfo* ssl_info = NULL; |
| + if (cert_error) |
| + ssl_info = &cert_error->ssl_info(); |
| + delegate_->CancelSSLRequest(request_id_, error, ssl_info); |
| request_has_been_notified_ = true; |
| // We're done with this object on the IO thread. |
| @@ -161,14 +148,7 @@ void SSLErrorHandler::CompleteContinueRequest() { |
| if (request_has_been_notified_) |
| return; |
| - net::URLRequest* request = |
| - resource_dispatcher_host_->GetURLRequest(request_id_); |
| - if (request) { |
| - // The request can be NULL if it was cancelled by the renderer (as the |
| - // result of the user navigating to a new page from the location bar). |
| - DVLOG(1) << "CompleteContinueRequest() url: " << request->url().spec(); |
| - request->ContinueDespiteLastError(); |
| - } |
| + delegate_->ContinueSSLRequest(request_id_); |
| request_has_been_notified_ = true; |
| // We're done with this object on the IO thread. |