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

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: rebase for retry Created 8 years, 9 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 | « content/browser/ssl/ssl_error_handler.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d81805281acd6622a7bd45242ae9f29c21b678fb..a4c1bf6ecf00c471dc332303c292d690160a113b 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.
« no previous file with comments | « content/browser/ssl/ssl_error_handler.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698