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

Unified Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2296953004: Send certificates to devtools when it's open instead of using certId (Closed)
Patch Set: clear certificates on didstartprovisionalload Created 4 years, 3 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/devtools/render_frame_devtools_agent_host.cc
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc
index fd05028a561ca3ce7da2207ec4ddaaff173f290e..4f96de96d65ba0593f111e133ff2a886f4431928 100644
--- a/content/browser/devtools/render_frame_devtools_agent_host.cc
+++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -39,10 +39,12 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/cert_store.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/browser_side_navigation_policy.h"
+#include "net/cert/x509_certificate.h"
#if defined(OS_ANDROID)
#include "content/public/browser/render_widget_host_view.h"
@@ -743,6 +745,8 @@ bool RenderFrameDevToolsAgentHost::OnMessageReceived(
OnDispatchOnInspectorFrontend)
IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_RequestNewWindow,
OnRequestNewWindow)
+ IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_ShowCertificateViewer,
+ OnShowCertificateViewer)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -1013,6 +1017,23 @@ void RenderFrameDevToolsAgentHost::OnRequestNewWindow(
sender->GetRoutingID(), success));
}
+void RenderFrameDevToolsAgentHost::OnShowCertificateViewer(
+ RenderFrameHost* sender, const std::vector<std::string>& certificate) {
+ std::vector<base::StringPiece> cert_string_piece;
+ for (auto& certificate_entry : certificate)
+ cert_string_piece.push_back(certificate_entry);
+ scoped_refptr<net::X509Certificate> cert =
+ net::X509Certificate::CreateFromDERCertChain(cert_string_piece);
+ DCHECK(cert);
+ // TODO(jam): temporarily add the certificate to the cert store (it will
+ // already be there, so this just gets an ID) so that we don't have to change
+ // the WCD method signature (will be done in followups).
+ int cert_id = CertStore::GetInstance()->StoreCert(
+ cert.get(), sender->GetProcess()->GetID());
+ web_contents()->GetDelegate()->ShowCertificateViewerInDevTools(
+ web_contents(), cert_id);
+}
+
bool RenderFrameDevToolsAgentHost::HasRenderFrameHost(
RenderFrameHost* host) {
return (current_ && current_->host() == host) ||

Powered by Google App Engine
This is Rietveld 408576698