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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2296953004: Send certificates to devtools when it's open instead of using certId (Closed)
Patch Set: self review 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
« no previous file with comments | « no previous file | content/browser/devtools/protocol/network_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index d0399b3a2752198a9b97b4a4ba32f11636af1cd7..d9c35831aeca3ced3713e497dbaa221c2dcb7992 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -681,23 +681,41 @@ void DevToolsUIBindings::SetWhitelistedShortcuts(const std::string& message) {
void DevToolsUIBindings::ShowCertificateViewer(const std::string& cert_chain) {
std::unique_ptr<base::Value> value =
base::JSONReader::Read(cert_chain);
- if (!value || value->GetType() != base::Value::TYPE_LIST)
+ if (!value || value->GetType() != base::Value::TYPE_LIST) {
+ NOTREACHED();
return;
+ }
std::unique_ptr<base::ListValue> list =
base::ListValue::From(std::move(value));
- std::vector<base::StringPiece> cert_string_piece;
+ std::vector<std::string> decoded;
for (size_t i = 0; i < list->GetSize(); ++i) {
base::Value* item;
- if (!list->Get(i, &item) || item->GetType() != base::Value::TYPE_STRING)
+ if (!list->Get(i, &item) || item->GetType() != base::Value::TYPE_STRING) {
+ NOTREACHED();
+ return;
+ }
+ std::string temp;
+ if (!item->GetAsString(&temp)) {
+ NOTREACHED();
+ return;
+ }
+ if (!base::Base64Decode(temp, &temp)) {
+ NOTREACHED();
return;
- cert_string_piece.push_back(
- *static_cast<base::StringValue*>(item)->GetString());
+ }
+ decoded.push_back(temp);
}
+
+ std::vector<base::StringPiece> cert_string_piece;
+ for (const auto& str : decoded)
+ cert_string_piece.push_back(str);
scoped_refptr<net::X509Certificate> cert =
net::X509Certificate::CreateFromDERCertChain(cert_string_piece);
- if (!cert)
+ if (!cert) {
+ NOTREACHED();
return;
+ }
// TODO(jam): temporarily add the certificate to the cert store to get an ID
// so that we don't have to change the WCD method signature
@@ -709,7 +727,7 @@ void DevToolsUIBindings::ShowCertificateViewer(const std::string& cert_chain) {
int cert_id = content::CertStore::GetInstance()->StoreCert(
cert.get(), rph->GetID());
web_contents_->GetDelegate()->ShowCertificateViewerInDevTools(
- web_contents_, cert_id);
+ inspected_wc, cert_id);
}
void DevToolsUIBindings::ZoomIn() {
« no previous file with comments | « no previous file | content/browser/devtools/protocol/network_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698