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

Unified Diff: content/browser/ssl/ssl_error_handler.cc

Issue 9406001: Factor out ResourceDispatcherHost dependent code around SSLManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflects darin's 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/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..7bd255e4626de71f466576fe8212f9b77295788b 100644
--- a/content/browser/ssl/ssl_error_handler.cc
+++ b/content/browser/ssl/ssl_error_handler.cc
@@ -6,8 +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"
#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 +15,24 @@
using content::BrowserThread;
using content::WebContents;
-
-SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHost* rdh,
- 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_(rdh),
- 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));
-
- 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_))
- 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 +128,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 +149,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.

Powered by Google App Engine
This is Rietveld 408576698