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

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

Issue 9406001: Factor out ResourceDispatcherHost dependent code around SSLManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflects wtc'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.h
diff --git a/content/browser/ssl/ssl_error_handler.h b/content/browser/ssl/ssl_error_handler.h
index 848b9d319abd4fcf95cecb93afbcb36d1e6ceb3a..03e6716a5d5f7f417b9a3a3a2baf49d9632569e3 100644
--- a/content/browser/ssl/ssl_error_handler.h
+++ b/content/browser/ssl/ssl_error_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,16 +10,16 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
-#include "content/browser/ssl/ssl_manager.h"
#include "content/common/content_export.h"
#include "content/public/browser/global_request_id.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/resource_type.h"
-class ResourceDispatcherHost;
class SSLCertErrorHandler;
+class SSLManager;
namespace net {
+class SSLInfo;
class URLRequest;
} // namespace net
@@ -39,6 +39,39 @@ class URLRequest;
//
class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
public:
+ // Delegate functions must be called from IO thread. All functions accept
+ // |id| as athe first argument. |id| is a copy of the second argument of
wtc 2012/02/24 00:44:38 Typo: athe => the
Takashi Toyoshima 2012/02/28 20:55:43 Done.
+ // SSLManager::OnSSLCertificateError() and represents the request.
+ // Query functions are used to retrieve the request related information.
+ // At last, CancelSSLRequest() or ContinueSSLRequest() will be called after
wtc 2012/02/24 00:44:38 Nit: "At last" probably should be "Finally" or "La
Takashi Toyoshima 2012/02/28 20:55:43 Done.
+ // SSLErrorHandler makes a decision on the SSL error.
+ class Delegate {
+ public:
+ // Query what kind of resource is associated with a request that generated
wtc 2012/02/24 00:44:38 Nit: change "Query" to "Queries" in these comments
Takashi Toyoshima 2012/02/28 20:55:43 Done.
+ // the error.
+ virtual ResourceType::Type ResourceTypeForSSLRequest(
wtc 2012/02/24 00:44:38 Nit: I suggest changing "SSLRequest" to just "Requ
Takashi Toyoshima 2012/02/28 20:55:43 As we discussed offline, the postfix "Request" wil
+ const content::GlobalRequestID& id) = 0;
+
+ // Query the requested URL which generated the error.
+ virtual const GURL& URLForSSLRequest(
+ const content::GlobalRequestID& id) = 0;
+
+ // Query the render process and view ids which represent RenderViewHost
+ // to which the request belong.
+ virtual bool RenderViewForSSLRequest(const content::GlobalRequestID& id,
+ int* render_process_host_id,
+ int* render_view_host_id) = 0;
+
+ // Called when SSLErrorHandler decides to cancel the request because of
+ // the SSL error.
+ virtual void CancelSSLRequest(const content::GlobalRequestID& id,
+ int error,
+ const net::SSLInfo* ssl_info) = 0;
+
+ // Called when SSLErrorHandler decides to continue the request despite the
+ // SSL error.
+ virtual void ContinueSSLRequest(const content::GlobalRequestID& id) = 0;
+ };
virtual SSLCertErrorHandler* AsSSLCertErrorHandler();
// Find the appropriate SSLManager for the net::URLRequest and begin handling
@@ -83,9 +116,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
friend class base::RefCountedThreadSafe<SSLErrorHandler>;
// Construct on the IO thread.
- SSLErrorHandler(ResourceDispatcherHost* resource_dispatcher_host,
- net::URLRequest* request,
- ResourceType::Type resource_type);
+ SSLErrorHandler(Delegate* delegate, const content::GlobalRequestID& id);
virtual ~SSLErrorHandler();
@@ -98,12 +129,12 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
// Should only be accessed on the UI thread.
SSLManager* manager_; // Our manager.
- // The id of the net::URLRequest associated with this object.
+ // The id of the request associated with this object.
// Should only be accessed from the IO thread.
content::GlobalRequestID request_id_;
- // The ResourceDispatcherHost we are associated with.
- ResourceDispatcherHost* resource_dispatcher_host_;
+ // The delegate we are associated with.
+ Delegate* delegate_;
private:
// Completes the CancelRequest operation on the IO thread.

Powered by Google App Engine
This is Rietveld 408576698