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

Unified Diff: extensions/browser/api/web_request/web_request_event_details.cc

Issue 2156763003: Extend the webRequest.onCompleted event details object with TLS/SSL information Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: extensions/browser/api/web_request/web_request_event_details.cc
diff --git a/extensions/browser/api/web_request/web_request_event_details.cc b/extensions/browser/api/web_request/web_request_event_details.cc
index 3099ca1f8d09d8feaba1a96e837058acb80bd95b..21ffc97caf754b77e7047c1f7e5a5d2178f6ef0b 100644
--- a/extensions/browser/api/web_request/web_request_event_details.cc
+++ b/extensions/browser/api/web_request/web_request_event_details.cc
@@ -199,4 +199,44 @@ void WebRequestEventDetails::OnDeterminedFrameData(
callback.Run(std::move(self));
}
+void WebRequestEventDetails::SetSSLInfo(const net::URLRequest* request) {
+ const net::SSLInfo ssl_info = request->ssl_info();
+ base::DictionaryValue* info_dict = new base::DictionaryValue();
+
+ info_dict->Set(keys::kConnectionInfoKey,
+ helpers::ExtractConnectionInfo(ssl_info));
+
+ base::DictionaryValue* built_dict = new base::DictionaryValue();
+ built_dict->SetBoolean(keys::kCertificateIssuedByKnownRootKey,
+ ssl_info.is_issued_by_known_root);
+ built_dict->Set(keys::kChainKey,
+ helpers::ExtractCertificateChain(ssl_info.cert));
+
+ base::ListValue* errors =
+ helpers::ParseCertificateStatusErrors(ssl_info.cert_status);
+ built_dict->SetBoolean(keys::kCertificateValidKey,
+ ssl_info.is_valid() && errors->GetSize() == 0);
+ if (errors->GetSize() != 0)
+ built_dict->Set(keys::kErrorsKey, errors);
+
+ if (ssl_info.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME)
+ built_dict->SetBoolean(keys::kNonUniqueNameKey, true);
+ if (ssl_info.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)
+ built_dict->SetBoolean(keys::kSHA1SignaturePresentKey, true);
+ if (ssl_info.cert_status & net::CERT_STATUS_CT_COMPLIANCE_FAILED)
+ built_dict->SetBoolean(keys::kCTComplianceFailedKey, true);
+
+ built_dict->SetBoolean(keys::kEVCertificateKey,
+ (ssl_info.cert_status & net::CERT_STATUS_IS_EV));
+ built_dict->SetBoolean(
+ keys::kRevocationCheckingEnabledKey,
+ (ssl_info.cert_status & net::CERT_STATUS_REV_CHECKING_ENABLED));
+
+ info_dict->Set(keys::kBuiltChainKey, built_dict);
+ info_dict->Set(keys::kSentChainKey,
+ helpers::ExtractCertificateChain(ssl_info.unverified_cert));
+
+ dict_.Set(keys::kSSLInfoKey, info_dict);
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698