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

Side by Side Diff: content/browser/devtools/protocol/security_handler.cc

Issue 2344113003: Fix DevTools showCertificateViewer to use visible entry (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/protocol/security_handler.h" 5 #include "content/browser/devtools/protocol/security_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" 9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 Response SecurityHandler::Disable() { 147 Response SecurityHandler::Disable() {
148 enabled_ = false; 148 enabled_ = false;
149 WebContentsObserver::Observe(nullptr); 149 WebContentsObserver::Observe(nullptr);
150 return Response::OK(); 150 return Response::OK();
151 } 151 }
152 152
153 Response SecurityHandler::ShowCertificateViewer() { 153 Response SecurityHandler::ShowCertificateViewer() {
154 if (!host_) 154 if (!host_)
155 return Response::InternalError("Could not connect to view"); 155 return Response::InternalError("Could not connect to view");
156 WebContents* web_contents = WebContents::FromRenderFrameHost(host_); 156 WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
157 scoped_refptr<net::X509Certificate> certificate = web_contents-> 157 scoped_refptr<net::X509Certificate> certificate =
158 GetController().GetLastCommittedEntry()->GetSSL().certificate; 158 web_contents->GetController().GetVisibleEntry()->GetSSL().certificate;
159 if (!certificate) 159 if (!certificate)
160 return Response::InternalError("Could not find certificate"); 160 return Response::InternalError("Could not find certificate");
161 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( 161 web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
162 web_contents, certificate); 162 web_contents, certificate);
163 return Response::OK(); 163 return Response::OK();
164 } 164 }
165 165
166 } // namespace security 166 } // namespace security
167 } // namespace devtools 167 } // namespace devtools
168 } // namespace content 168 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698