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

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

Issue 2639203003: Add certificate error handling to devtools. (Closed)
Patch Set: plumb error through agent host Created 3 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_manager.cc
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index df2e7575b49da85f0455e6e880cc5e0f01d02318..10fa3affa34b55d237e92436b766397f5513e1c0 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -11,6 +11,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/supports_user_data.h"
+#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/loader/resource_request_info_impl.h"
@@ -20,6 +21,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/certificate_request_result_type.h"
#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/ssl_host_state_delegate.h"
#include "net/url_request/url_request.h"
@@ -356,11 +358,20 @@ void SSLManager::OnCertErrorInternal(std::unique_ptr<SSLErrorHandler> handler,
const net::SSLInfo& ssl_info = handler->ssl_info();
const GURL& request_url = handler->request_url();
ResourceType resource_type = handler->resource_type();
- GetContentClient()->browser()->AllowCertificateError(
- web_contents, cert_error, ssl_info, request_url, resource_type,
- overridable, strict_enforcement, expired_previous_decision,
+
+ base::Callback<void(content::CertificateRequestResultType)> callback =
base::Bind(&OnAllowCertificate, base::Owned(handler.release()),
- ssl_host_state_delegate_));
+ ssl_host_state_delegate_);
+
+ RenderFrameDevToolsAgentHost* agent_host =
+ static_cast<RenderFrameDevToolsAgentHost*>(
+ DevToolsAgentHost::GetOrCreateFor(web_contents).get());
+ if (!RenderFrameDevToolsAgentHost::NotifyCertificateError(
+ agent_host, cert_error, request_url, callback)) {
+ GetContentClient()->browser()->AllowCertificateError(
+ web_contents, cert_error, ssl_info, request_url, resource_type,
+ overridable, strict_enforcement, expired_previous_decision, callback);
+ }
}
void SSLManager::UpdateEntry(NavigationEntryImpl* entry,

Powered by Google App Engine
This is Rietveld 408576698