Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/certificate_viewer_webui.h" | 5 #include "chrome/browser/ui/webui/certificate_viewer_webui.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 } | 162 } |
| 163 cert_info.SetString("general.issue-date", issued_str); | 163 cert_info.SetString("general.issue-date", issued_str); |
| 164 cert_info.SetString("general.expiry-date", expires_str); | 164 cert_info.SetString("general.expiry-date", expires_str); |
| 165 | 165 |
| 166 cert_info.SetString("general.sha256", | 166 cert_info.SetString("general.sha256", |
| 167 x509_certificate_model::HashCertSHA256(cert_hnd)); | 167 x509_certificate_model::HashCertSHA256(cert_hnd)); |
| 168 cert_info.SetString("general.sha1", | 168 cert_info.SetString("general.sha1", |
| 169 x509_certificate_model::HashCertSHA1(cert_hnd)); | 169 x509_certificate_model::HashCertSHA1(cert_hnd)); |
| 170 | 170 |
| 171 // Certificate hierarchy is constructed from bottom up. | 171 // Certificate hierarchy is constructed from bottom up. |
| 172 base::ListValue* children = NULL; | 172 std::unique_ptr<base::ListValue> children; |
| 173 int index = 0; | 173 int index = 0; |
| 174 for (net::X509Certificate::OSCertHandles::const_iterator i = | 174 for (net::X509Certificate::OSCertHandles::const_iterator i = |
| 175 cert_chain.begin(); i != cert_chain.end(); ++i, ++index) { | 175 cert_chain.begin(); i != cert_chain.end(); ++i, ++index) { |
| 176 std::unique_ptr<base::DictionaryValue> cert_node( | 176 std::unique_ptr<base::DictionaryValue> cert_node( |
| 177 new base::DictionaryValue()); | 177 new base::DictionaryValue()); |
| 178 base::ListValue cert_details; | 178 base::ListValue cert_details; |
| 179 cert_node->SetString("label", x509_certificate_model::GetTitle(*i).c_str()); | 179 cert_node->SetString("label", x509_certificate_model::GetTitle(*i).c_str()); |
| 180 cert_node->SetDouble("payload.index", index); | 180 cert_node->SetDouble("payload.index", index); |
| 181 // Add the child from the previous iteration. | 181 // Add the child from the previous iteration. |
| 182 if (children) | 182 if (children) |
| 183 cert_node->Set("children", children); | 183 cert_node->Set("children", std::move(children)); |
| 184 | 184 |
| 185 // Add this node to the children list for the next iteration. | 185 // Add this node to the children list for the next iteration. |
| 186 children = new base::ListValue(); | 186 children = base::MakeUnique<base::ListValue>(); |
| 187 children->Append(std::move(cert_node)); | 187 children->Append(std::move(cert_node)); |
| 188 } | 188 } |
| 189 // Set the last node as the top of the certificate hierarchy. | 189 // Set the last node as the top of the certificate hierarchy. |
| 190 cert_info.Set("hierarchy", children); | 190 cert_info.Set("hierarchy", std::move(children)); |
| 191 | 191 |
| 192 base::JSONWriter::Write(cert_info, &data); | 192 base::JSONWriter::Write(cert_info, &data); |
| 193 | 193 |
| 194 return data; | 194 return data; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void CertificateViewerModalDialog::OnDialogShown( | 197 void CertificateViewerModalDialog::OnDialogShown( |
| 198 content::WebUI* webui, | 198 content::WebUI* webui, |
| 199 content::RenderViewHost* render_view_host) { | 199 content::RenderViewHost* render_view_host) { |
| 200 webui_ = webui; | 200 webui_ = webui; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 } | 284 } |
| 285 | 285 |
| 286 void CertificateViewerDialogHandler::RequestCertificateFields( | 286 void CertificateViewerDialogHandler::RequestCertificateFields( |
| 287 const base::ListValue* args) { | 287 const base::ListValue* args) { |
| 288 int cert_index = GetCertificateIndex(args); | 288 int cert_index = GetCertificateIndex(args); |
| 289 if (cert_index < 0) | 289 if (cert_index < 0) |
| 290 return; | 290 return; |
| 291 | 291 |
| 292 net::X509Certificate::OSCertHandle cert = cert_chain_[cert_index]; | 292 net::X509Certificate::OSCertHandle cert = cert_chain_[cert_index]; |
| 293 | 293 |
| 294 base::ListValue root_list; | 294 auto root_node_details = base::MakeUnique<base::DictionaryValue>(); |
| 295 base::DictionaryValue* node_details; | 295 root_node_details->SetString("label", x509_certificate_model::GetTitle(cert)); |
| 296 base::DictionaryValue* alt_node_details; | |
| 297 base::ListValue* cert_sub_fields; | |
| 298 root_list.Append( | |
| 299 base::WrapUnique(node_details = new base::DictionaryValue())); | |
| 300 node_details->SetString("label", x509_certificate_model::GetTitle(cert)); | |
| 301 | 296 |
| 302 base::ListValue* cert_fields; | 297 auto root_cert_fields = base::MakeUnique<base::ListValue>(); |
| 303 node_details->Set("children", cert_fields = new base::ListValue()); | 298 auto root_cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 304 cert_fields->Append( | 299 root_cert_field->SetString( |
| 305 base::WrapUnique(node_details = new base::DictionaryValue())); | 300 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE)); |
| 306 | 301 |
| 307 node_details->SetString("label", | 302 auto cert_fields = base::MakeUnique<base::ListValue>(); |
| 308 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE)); | |
| 309 node_details->Set("children", cert_fields = new base::ListValue()); | |
| 310 | 303 |
| 311 // Main certificate fields. | 304 // Main certificate fields. |
| 312 cert_fields->Append( | 305 auto cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 313 base::WrapUnique(node_details = new base::DictionaryValue())); | 306 cert_field->SetString("label", |
| 314 node_details->SetString("label", | 307 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VERSION)); |
| 315 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VERSION)); | |
| 316 std::string version = x509_certificate_model::GetVersion(cert); | 308 std::string version = x509_certificate_model::GetVersion(cert); |
| 317 if (!version.empty()) | 309 if (!version.empty()) { |
| 318 node_details->SetString("payload.val", | 310 cert_field->SetString("payload.val", l10n_util::GetStringFUTF8( |
| 319 l10n_util::GetStringFUTF8(IDS_CERT_DETAILS_VERSION_FORMAT, | 311 IDS_CERT_DETAILS_VERSION_FORMAT, |
| 320 base::UTF8ToUTF16(version))); | 312 base::UTF8ToUTF16(version))); |
| 313 } | |
| 314 cert_fields->Append(std::move(cert_field)); | |
| 321 | 315 |
| 322 cert_fields->Append( | 316 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 323 base::WrapUnique(node_details = new base::DictionaryValue())); | 317 cert_field->SetString( |
| 324 node_details->SetString("label", | 318 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SERIAL_NUMBER)); |
| 325 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SERIAL_NUMBER)); | 319 cert_field->SetString( |
| 326 node_details->SetString("payload.val", | 320 "payload.val", |
| 327 x509_certificate_model::GetSerialNumberHexified(cert, | 321 x509_certificate_model::GetSerialNumberHexified( |
| 328 l10n_util::GetStringUTF8(IDS_CERT_INFO_FIELD_NOT_PRESENT))); | 322 cert, l10n_util::GetStringUTF8(IDS_CERT_INFO_FIELD_NOT_PRESENT))); |
| 323 cert_fields->Append(std::move(cert_field)); | |
| 329 | 324 |
| 330 cert_fields->Append( | 325 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 331 base::WrapUnique(node_details = new base::DictionaryValue())); | 326 cert_field->SetString( |
| 332 node_details->SetString("label", | 327 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE_SIG_ALG)); |
| 333 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE_SIG_ALG)); | 328 cert_field->SetString( |
| 334 node_details->SetString("payload.val", | 329 "payload.val", |
| 335 x509_certificate_model::ProcessSecAlgorithmSignature(cert)); | 330 x509_certificate_model::ProcessSecAlgorithmSignature(cert)); |
| 331 cert_fields->Append(std::move(cert_field)); | |
| 336 | 332 |
| 337 cert_fields->Append( | 333 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 338 base::WrapUnique(node_details = new base::DictionaryValue())); | 334 cert_field->SetString("label", |
| 339 node_details->SetString("label", | 335 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_ISSUER)); |
| 340 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_ISSUER)); | 336 cert_field->SetString("payload.val", |
| 341 node_details->SetString("payload.val", | 337 x509_certificate_model::GetIssuerName(cert)); |
| 342 x509_certificate_model::GetIssuerName(cert)); | 338 cert_fields->Append(std::move(cert_field)); |
| 343 | 339 |
| 344 // Validity period. | 340 // Validity period. |
| 345 cert_fields->Append( | 341 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 346 base::WrapUnique(node_details = new base::DictionaryValue())); | 342 cert_field->SetString("label", |
| 347 node_details->SetString("label", | 343 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY)); |
| 348 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY)); | |
| 349 | 344 |
| 350 node_details->Set("children", cert_sub_fields = new base::ListValue()); | |
| 351 cert_sub_fields->Append( | |
| 352 base::WrapUnique(node_details = new base::DictionaryValue())); | |
| 353 node_details->SetString("label", | |
| 354 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE)); | |
| 355 cert_sub_fields->Append( | |
| 356 base::WrapUnique(alt_node_details = new base::DictionaryValue())); | |
| 357 alt_node_details->SetString("label", | |
| 358 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER)); | |
| 359 base::Time issued, expires; | 345 base::Time issued, expires; |
| 360 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 346 bool obtained_times = |
| 361 node_details->SetString( | 347 x509_certificate_model::GetTimes(cert, &issued, &expires); |
| 348 auto cert_sub_fields = base::MakeUnique<base::ListValue>(); | |
| 349 auto cert_sub_field = base::MakeUnique<base::DictionaryValue>(); | |
| 350 cert_sub_field->SetString( | |
| 351 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE)); | |
| 352 if (obtained_times) { | |
| 353 cert_sub_field->SetString( | |
| 362 "payload.val", | 354 "payload.val", |
| 363 base::UTF16ToUTF8( | 355 base::UTF16ToUTF8( |
| 364 base::TimeFormatShortDateAndTimeWithTimeZone(issued))); | 356 base::TimeFormatShortDateAndTimeWithTimeZone(issued))); |
| 365 alt_node_details->SetString( | 357 } |
| 358 cert_sub_fields->Append(std::move(cert_sub_field)); | |
| 359 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); | |
| 360 cert_sub_field->SetString( | |
| 361 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER)); | |
| 362 if (obtained_times) { | |
| 363 cert_sub_field->SetString( | |
| 366 "payload.val", | 364 "payload.val", |
| 367 base::UTF16ToUTF8( | 365 base::UTF16ToUTF8( |
| 368 base::TimeFormatShortDateAndTimeWithTimeZone(expires))); | 366 base::TimeFormatShortDateAndTimeWithTimeZone(expires))); |
| 369 } | 367 } |
| 368 cert_sub_fields->Append(std::move(cert_sub_field)); | |
| 369 cert_field->Set("children", std::move(cert_sub_fields)); | |
| 370 cert_fields->Append(std::move(cert_field)); | |
| 370 | 371 |
| 371 cert_fields->Append( | 372 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 372 base::WrapUnique(node_details = new base::DictionaryValue())); | 373 cert_field->SetString("label", |
| 373 node_details->SetString("label", | 374 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT)); |
| 374 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT)); | 375 cert_field->SetString("payload.val", |
| 375 node_details->SetString("payload.val", | 376 x509_certificate_model::GetSubjectName(cert)); |
| 376 x509_certificate_model::GetSubjectName(cert)); | 377 cert_fields->Append(std::move(cert_field)); |
| 377 | 378 |
| 378 // Subject key information. | 379 // Subject key information. |
| 379 cert_fields->Append( | 380 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 380 base::WrapUnique(node_details = new base::DictionaryValue())); | 381 cert_field->SetString( |
| 381 node_details->SetString("label", | 382 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY_INFO)); |
| 382 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY_INFO)); | |
| 383 | 383 |
| 384 node_details->Set("children", cert_sub_fields = new base::ListValue()); | 384 cert_sub_fields = base::MakeUnique<base::ListValue>(); |
| 385 cert_sub_fields->Append( | 385 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); |
| 386 base::WrapUnique(node_details = new base::DictionaryValue())); | 386 cert_sub_field->SetString( |
| 387 node_details->SetString("label", | 387 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY_ALG)); |
| 388 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY_ALG)); | 388 cert_sub_field->SetString( |
| 389 node_details->SetString("payload.val", | 389 "payload.val", |
| 390 x509_certificate_model::ProcessSecAlgorithmSubjectPublicKey(cert)); | 390 x509_certificate_model::ProcessSecAlgorithmSubjectPublicKey(cert)); |
| 391 cert_sub_fields->Append( | 391 cert_sub_fields->Append(std::move(cert_sub_field)); |
| 392 base::WrapUnique(node_details = new base::DictionaryValue())); | 392 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); |
| 393 node_details->SetString("label", | 393 cert_sub_field->SetString( |
| 394 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY)); | 394 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT_KEY)); |
| 395 node_details->SetString("payload.val", | 395 cert_sub_field->SetString( |
| 396 x509_certificate_model::ProcessSubjectPublicKeyInfo(cert)); | 396 "payload.val", x509_certificate_model::ProcessSubjectPublicKeyInfo(cert)); |
| 397 cert_sub_fields->Append(std::move(cert_sub_field)); | |
| 398 cert_field->Set("children", std::move(cert_sub_fields)); | |
| 399 cert_fields->Append(std::move(cert_field)); | |
| 397 | 400 |
| 398 // Extensions. | 401 // Extensions. |
| 399 x509_certificate_model::Extensions extensions; | 402 x509_certificate_model::Extensions extensions; |
| 400 x509_certificate_model::GetExtensions( | 403 x509_certificate_model::GetExtensions( |
| 401 l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_CRITICAL), | 404 l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_CRITICAL), |
| 402 l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_NON_CRITICAL), | 405 l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_NON_CRITICAL), |
| 403 cert, &extensions); | 406 cert, &extensions); |
| 404 | 407 |
| 405 if (!extensions.empty()) { | 408 if (!extensions.empty()) { |
| 406 cert_fields->Append( | 409 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 407 base::WrapUnique(node_details = new base::DictionaryValue())); | 410 cert_field->SetString( |
| 408 node_details->SetString("label", | 411 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_EXTENSIONS)); |
| 409 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_EXTENSIONS)); | |
| 410 | 412 |
| 411 node_details->Set("children", cert_sub_fields = new base::ListValue()); | 413 cert_sub_fields = base::MakeUnique<base::ListValue>(); |
| 412 for (x509_certificate_model::Extensions::const_iterator i = | 414 for (x509_certificate_model::Extensions::const_iterator i = |
| 413 extensions.begin(); i != extensions.end(); ++i) { | 415 extensions.begin(); |
| 414 cert_sub_fields->Append( | 416 i != extensions.end(); ++i) { |
| 415 base::WrapUnique(node_details = new base::DictionaryValue())); | 417 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); |
| 416 node_details->SetString("label", i->name); | 418 cert_sub_field->SetString("label", i->name); |
| 417 node_details->SetString("payload.val", i->value); | 419 cert_sub_field->SetString("payload.val", i->value); |
| 420 cert_sub_fields->Append(std::move(cert_sub_field)); | |
| 418 } | 421 } |
| 422 cert_field->Set("children", std::move(cert_sub_fields)); | |
| 423 cert_fields->Append(std::move(cert_field)); | |
| 419 } | 424 } |
| 420 | 425 |
| 421 cert_fields->Append( | 426 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 422 base::WrapUnique(node_details = new base::DictionaryValue())); | 427 cert_field->SetString( |
| 423 node_details->SetString("label", | 428 "label", l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE_SIG_ALG)); |
| 424 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE_SIG_ALG)); | 429 cert_field->SetString( |
| 425 node_details->SetString("payload.val", | 430 "payload.val", |
| 426 x509_certificate_model::ProcessSecAlgorithmSignatureWrap(cert)); | 431 x509_certificate_model::ProcessSecAlgorithmSignatureWrap(cert)); |
| 432 cert_fields->Append(std::move(cert_field)); | |
| 427 | 433 |
| 428 cert_fields->Append( | 434 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 429 base::WrapUnique(node_details = new base::DictionaryValue())); | 435 cert_field->SetString("label", l10n_util::GetStringUTF8( |
| 430 node_details->SetString("label", | 436 IDS_CERT_DETAILS_CERTIFICATE_SIG_VALUE)); |
| 431 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE_SIG_VALUE)); | 437 cert_field->SetString( |
| 432 node_details->SetString("payload.val", | 438 "payload.val", x509_certificate_model::ProcessRawBitsSignatureWrap(cert)); |
| 433 x509_certificate_model::ProcessRawBitsSignatureWrap(cert)); | 439 cert_fields->Append(std::move(cert_field)); |
| 434 | 440 |
| 435 cert_fields->Append( | 441 cert_field = base::MakeUnique<base::DictionaryValue>(); |
| 436 base::WrapUnique(node_details = new base::DictionaryValue())); | 442 cert_field->SetString( |
| 437 node_details->SetString("label", | 443 "label", l10n_util::GetStringUTF8(IDS_CERT_INFO_FINGERPRINTS_GROUP)); |
| 438 l10n_util::GetStringUTF8(IDS_CERT_INFO_FINGERPRINTS_GROUP)); | 444 cert_field->Set("children", std::move(cert_sub_fields)); |
|
vabr (Chromium)
2017/04/11 19:20:19
This line needs to be deleted.
| |
| 439 node_details->Set("children", cert_sub_fields = new base::ListValue()); | |
| 440 | 445 |
| 441 cert_sub_fields->Append( | 446 cert_sub_fields = base::MakeUnique<base::ListValue>(); |
| 442 base::WrapUnique(node_details = new base::DictionaryValue())); | 447 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); |
| 443 node_details->SetString("label", | 448 cert_sub_field->SetString( |
| 449 "label", | |
| 444 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL)); | 450 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL)); |
| 445 node_details->SetString("payload.val", | 451 cert_sub_field->SetString("payload.val", |
| 446 x509_certificate_model::HashCertSHA256(cert)); | 452 x509_certificate_model::HashCertSHA256(cert)); |
| 447 cert_sub_fields->Append( | 453 cert_sub_fields->Append(std::move(cert_sub_field)); |
| 448 base::WrapUnique(node_details = new base::DictionaryValue())); | 454 cert_sub_field = base::MakeUnique<base::DictionaryValue>(); |
| 449 node_details->SetString("label", | 455 cert_sub_field->SetString( |
| 450 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); | 456 "label", l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); |
| 451 node_details->SetString("payload.val", | 457 cert_sub_field->SetString("payload.val", |
| 452 x509_certificate_model::HashCertSHA1(cert)); | 458 x509_certificate_model::HashCertSHA1(cert)); |
| 459 cert_sub_fields->Append(std::move(cert_sub_field)); | |
| 460 cert_field->Set("children", std::move(cert_sub_fields)); | |
| 461 cert_fields->Append(std::move(cert_field)); | |
| 453 | 462 |
| 463 root_cert_field->Set("children", std::move(cert_fields)); | |
| 464 root_cert_fields->Append(std::move(root_cert_field)); | |
| 465 root_node_details->Set("children", std::move(root_cert_fields)); | |
| 466 | |
| 467 base::ListValue root_list; | |
| 468 root_list.Append(std::move(root_node_details)); | |
| 454 // Send certificate information to javascript. | 469 // Send certificate information to javascript. |
| 455 web_ui()->CallJavascriptFunctionUnsafe("cert_viewer.getCertificateFields", | 470 web_ui()->CallJavascriptFunctionUnsafe("cert_viewer.getCertificateFields", |
| 456 root_list); | 471 root_list); |
| 457 } | 472 } |
| 458 | 473 |
| 459 int CertificateViewerDialogHandler::GetCertificateIndex( | 474 int CertificateViewerDialogHandler::GetCertificateIndex( |
| 460 const base::ListValue* args) const { | 475 const base::ListValue* args) const { |
| 461 int cert_index; | 476 int cert_index; |
| 462 double val; | 477 double val; |
| 463 if (!(args->GetDouble(0, &val))) | 478 if (!(args->GetDouble(0, &val))) |
| 464 return -1; | 479 return -1; |
| 465 cert_index = static_cast<int>(val); | 480 cert_index = static_cast<int>(val); |
| 466 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) | 481 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) |
| 467 return -1; | 482 return -1; |
| 468 return cert_index; | 483 return cert_index; |
| 469 } | 484 } |
| OLD | NEW |