summaryrefslogtreecommitdiffstats
path: root/content/browser/ssl/ssl_error_handler.cc
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 02:24:34 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 02:24:34 +0000
commit043cc11910894f4bb2ae1c013d498964c6b84427 (patch)
tree9319203cad07b9a812a119a573fb775ac7c75631 /content/browser/ssl/ssl_error_handler.cc
parent97f78dd293f231630da59645af0c561efb2e5364 (diff)
downloadchromium_src-043cc11910894f4bb2ae1c013d498964c6b84427.zip
chromium_src-043cc11910894f4bb2ae1c013d498964c6b84427.tar.gz
chromium_src-043cc11910894f4bb2ae1c013d498964c6b84427.tar.bz2
Factor out ResourceDispatcherHost dependent code around SSLManager
Because SSLManager must work with not only ResourceDispatcherHost. BUG=53836 TEST=existing tests will cover this refactoring Review URL: http://codereview.chromium.org/9406001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/ssl/ssl_error_handler.cc')
-rw-r--r--content/browser/ssl/ssl_error_handler.cc57
1 files changed, 20 insertions, 37 deletions
diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc
index d818052..a4c1bf6 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_impl.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
#include "content/browser/ssl/ssl_cert_error_handler.h"
#include "content/browser/tab_contents/navigation_controller_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -17,27 +16,25 @@
using content::BrowserThread;
using content::RenderViewHostImpl;
-using content::ResourceDispatcherHostImpl;
-using content::ResourceRequestInfo;
using content::WebContents;
-
-SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHostImpl* host,
- net::URLRequest* request,
- ResourceType::Type resource_type)
+using net::SSLInfo;
+
+SSLErrorHandler::SSLErrorHandler(Delegate* delegate,
+ const content::GlobalRequestID& id,
+ ResourceType::Type resource_type,
+ const GURL& url,
+ int render_process_id,
+ int render_view_id)
: manager_(NULL),
- request_id_(0, 0),
- resource_dispatcher_host_(host),
- request_url_(request->url()),
+ request_id_(id),
+ delegate_(delegate),
+ render_process_id_(render_process_id),
+ render_view_id_(render_view_id),
+ request_url_(url),
resource_type_(resource_type),
request_has_been_notified_(false) {
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
- request_id_.child_id = info->GetChildID();
- request_id_.request_id = info->GetRequestID();
-
- if (!info->GetAssociatedRenderView(&render_process_id_, &render_view_id_))
- NOTREACHED();
+ DCHECK(delegate);
// This makes sure we don't disappear on the IO thread until we've given an
// answer to the net::URLRequest.
@@ -133,18 +130,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 +151,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.