| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/certificate_viewer.h" | 5 #include "chrome/browser/gtk/certificate_viewer.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 AddKeyValue(table, row++, | 253 AddKeyValue(table, row++, |
| 254 l10n_util::GetStringUTF8(IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL), | 254 l10n_util::GetStringUTF8(IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL), |
| 255 x509_certificate_model::GetIssuerOrgUnitName( | 255 x509_certificate_model::GetIssuerOrgUnitName( |
| 256 cert, alternative_text)); | 256 cert, alternative_text)); |
| 257 | 257 |
| 258 row += 2; // Add spacing (kControlSpacing * 3 == kContentAreaSpacing). | 258 row += 2; // Add spacing (kControlSpacing * 3 == kContentAreaSpacing). |
| 259 | 259 |
| 260 base::Time issued, expires; | 260 base::Time issued, expires; |
| 261 std::string issued_str, expires_str; | 261 std::string issued_str, expires_str; |
| 262 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 262 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
| 263 issued_str = WideToUTF8( | 263 issued_str = UTF16ToUTF8( |
| 264 base::TimeFormatShortDateNumeric(issued)); | 264 base::TimeFormatShortDateNumeric(issued)); |
| 265 expires_str = WideToUTF8( | 265 expires_str = UTF16ToUTF8( |
| 266 base::TimeFormatShortDateNumeric(expires)); | 266 base::TimeFormatShortDateNumeric(expires)); |
| 267 } else { | 267 } else { |
| 268 issued_str = alternative_text; | 268 issued_str = alternative_text; |
| 269 expires_str = alternative_text; | 269 expires_str = alternative_text; |
| 270 } | 270 } |
| 271 AddTitle(table, row++, | 271 AddTitle(table, row++, |
| 272 l10n_util::GetStringUTF8(IDS_CERT_INFO_VALIDITY_GROUP)); | 272 l10n_util::GetStringUTF8(IDS_CERT_INFO_VALIDITY_GROUP)); |
| 273 AddKeyValue(table, row++, | 273 AddKeyValue(table, row++, |
| 274 l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUED_ON_LABEL), | 274 l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUED_ON_LABEL), |
| 275 issued_str); | 275 issued_str); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 gtk_tree_store_set( | 382 gtk_tree_store_set( |
| 383 store, &validity_iter, | 383 store, &validity_iter, |
| 384 FIELDS_NAME, | 384 FIELDS_NAME, |
| 385 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY).c_str(), | 385 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY).c_str(), |
| 386 FIELDS_VALUE, "", | 386 FIELDS_VALUE, "", |
| 387 -1); | 387 -1); |
| 388 | 388 |
| 389 base::Time issued, expires; | 389 base::Time issued, expires; |
| 390 std::string issued_str, expires_str; | 390 std::string issued_str, expires_str; |
| 391 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 391 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
| 392 issued_str = WideToUTF8(base::TimeFormatShortDateAndTime(issued)); | 392 issued_str = UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued)); |
| 393 expires_str = WideToUTF8(base::TimeFormatShortDateAndTime(expires)); | 393 expires_str = UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires)); |
| 394 } | 394 } |
| 395 gtk_tree_store_append(store, &iter, &validity_iter); | 395 gtk_tree_store_append(store, &iter, &validity_iter); |
| 396 gtk_tree_store_set( | 396 gtk_tree_store_set( |
| 397 store, &iter, | 397 store, &iter, |
| 398 FIELDS_NAME, | 398 FIELDS_NAME, |
| 399 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE).c_str(), | 399 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE).c_str(), |
| 400 FIELDS_VALUE, issued_str.c_str(), | 400 FIELDS_VALUE, issued_str.c_str(), |
| 401 -1); | 401 -1); |
| 402 gtk_tree_store_append(store, &iter, &validity_iter); | 402 gtk_tree_store_append(store, &iter, &validity_iter); |
| 403 gtk_tree_store_set( | 403 gtk_tree_store_set( |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 net::X509Certificate::OSCertHandle cert) { | 685 net::X509Certificate::OSCertHandle cert) { |
| 686 net::X509Certificate::OSCertHandles cert_chain; | 686 net::X509Certificate::OSCertHandles cert_chain; |
| 687 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); | 687 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); |
| 688 (new CertificateViewer(parent, cert_chain))->Show(); | 688 (new CertificateViewer(parent, cert_chain))->Show(); |
| 689 } | 689 } |
| 690 | 690 |
| 691 void ShowCertificateViewer(gfx::NativeWindow parent, | 691 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 692 net::X509Certificate* cert) { | 692 net::X509Certificate* cert) { |
| 693 ShowCertificateViewer(parent, cert->os_cert_handle()); | 693 ShowCertificateViewer(parent, cert->os_cert_handle()); |
| 694 } | 694 } |
| OLD | NEW |