OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/browser/api/web_request/web_request_event_details.h" | 5 #include "extensions/browser/api/web_request/web_request_event_details.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 void WebRequestEventDetails::OnDeterminedFrameData( | 192 void WebRequestEventDetails::OnDeterminedFrameData( |
193 std::unique_ptr<WebRequestEventDetails> self, | 193 std::unique_ptr<WebRequestEventDetails> self, |
194 const DeterminedFrameDataCallback& callback, | 194 const DeterminedFrameDataCallback& callback, |
195 const ExtensionApiFrameIdMap::FrameData& frame_data) { | 195 const ExtensionApiFrameIdMap::FrameData& frame_data) { |
196 dict_.SetInteger(keys::kTabIdKey, frame_data.tab_id); | 196 dict_.SetInteger(keys::kTabIdKey, frame_data.tab_id); |
197 dict_.SetInteger(keys::kFrameIdKey, frame_data.frame_id); | 197 dict_.SetInteger(keys::kFrameIdKey, frame_data.frame_id); |
198 dict_.SetInteger(keys::kParentFrameIdKey, frame_data.parent_frame_id); | 198 dict_.SetInteger(keys::kParentFrameIdKey, frame_data.parent_frame_id); |
199 callback.Run(std::move(self)); | 199 callback.Run(std::move(self)); |
200 } | 200 } |
201 | 201 |
| 202 void WebRequestEventDetails::SetSSLInfo(const net::URLRequest* request) { |
| 203 const net::SSLInfo ssl_info = request->ssl_info(); |
| 204 base::DictionaryValue* info_dict = new base::DictionaryValue(); |
| 205 |
| 206 info_dict->Set(keys::kConnectionInfoKey, |
| 207 helpers::ExtractConnectionInfo(ssl_info)); |
| 208 |
| 209 base::DictionaryValue* built_dict = new base::DictionaryValue(); |
| 210 built_dict->SetBoolean(keys::kCertificateIssuedByKnownRootKey, |
| 211 ssl_info.is_issued_by_known_root); |
| 212 built_dict->Set(keys::kChainKey, |
| 213 helpers::ExtractCertificateChain(ssl_info.cert)); |
| 214 |
| 215 base::ListValue* errors = |
| 216 helpers::ParseCertificateStatusErrors(ssl_info.cert_status); |
| 217 built_dict->SetBoolean(keys::kCertificateValidKey, |
| 218 ssl_info.is_valid() && errors->GetSize() == 0); |
| 219 if (errors->GetSize() != 0) |
| 220 built_dict->Set(keys::kErrorsKey, errors); |
| 221 |
| 222 if (ssl_info.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) |
| 223 built_dict->SetBoolean(keys::kNonUniqueNameKey, true); |
| 224 if (ssl_info.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) |
| 225 built_dict->SetBoolean(keys::kSHA1SignaturePresentKey, true); |
| 226 if (ssl_info.cert_status & net::CERT_STATUS_CT_COMPLIANCE_FAILED) |
| 227 built_dict->SetBoolean(keys::kCTComplianceFailedKey, true); |
| 228 |
| 229 built_dict->SetBoolean(keys::kEVCertificateKey, |
| 230 (ssl_info.cert_status & net::CERT_STATUS_IS_EV)); |
| 231 built_dict->SetBoolean( |
| 232 keys::kRevocationCheckingEnabledKey, |
| 233 (ssl_info.cert_status & net::CERT_STATUS_REV_CHECKING_ENABLED)); |
| 234 |
| 235 info_dict->Set(keys::kBuiltChainKey, built_dict); |
| 236 info_dict->Set(keys::kSentChainKey, |
| 237 helpers::ExtractCertificateChain(ssl_info.unverified_cert)); |
| 238 |
| 239 dict_.Set(keys::kSSLInfoKey, info_dict); |
| 240 } |
| 241 |
202 } // namespace extensions | 242 } // namespace extensions |
OLD | NEW |