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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL)); | 420 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL)); |
421 node_details->SetString("payload.val", | 421 node_details->SetString("payload.val", |
422 x509_certificate_model::HashCertSHA256(cert)); | 422 x509_certificate_model::HashCertSHA256(cert)); |
423 cert_sub_fields->Append(node_details = new base::DictionaryValue()); | 423 cert_sub_fields->Append(node_details = new base::DictionaryValue()); |
424 node_details->SetString("label", | 424 node_details->SetString("label", |
425 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); | 425 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); |
426 node_details->SetString("payload.val", | 426 node_details->SetString("payload.val", |
427 x509_certificate_model::HashCertSHA1(cert)); | 427 x509_certificate_model::HashCertSHA1(cert)); |
428 | 428 |
429 // Send certificate information to javascript. | 429 // Send certificate information to javascript. |
430 web_ui()->CallJavascriptFunction("cert_viewer.getCertificateFields", | 430 web_ui()->CallJavascriptFunctionUnsafe("cert_viewer.getCertificateFields", |
431 root_list); | 431 root_list); |
432 } | 432 } |
433 | 433 |
434 int CertificateViewerDialogHandler::GetCertificateIndex( | 434 int CertificateViewerDialogHandler::GetCertificateIndex( |
435 const base::ListValue* args) const { | 435 const base::ListValue* args) const { |
436 int cert_index; | 436 int cert_index; |
437 double val; | 437 double val; |
438 if (!(args->GetDouble(0, &val))) | 438 if (!(args->GetDouble(0, &val))) |
439 return -1; | 439 return -1; |
440 cert_index = static_cast<int>(val); | 440 cert_index = static_cast<int>(val); |
441 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) | 441 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) |
442 return -1; | 442 return -1; |
443 return cert_index; | 443 return cert_index; |
444 } | 444 } |
OLD | NEW |