| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gtk/certificate_viewer.h" | |
| 6 | |
| 7 #include <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 8 | 6 |
| 9 #include <algorithm> | 7 #include <algorithm> |
| 10 #include <vector> | 8 #include <vector> |
| 11 | 9 |
| 12 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 15 #include "base/time.h" | 13 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/certificate_viewer.h" |
| 17 #include "chrome/browser/ui/gtk/certificate_dialogs.h" | 16 #include "chrome/browser/ui/gtk/certificate_dialogs.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 19 #include "chrome/common/net/x509_certificate_model.h" | 18 #include "chrome/common/net/x509_certificate_model.h" |
| 20 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 21 #include "net/base/x509_certificate.h" | 20 #include "net/base/x509_certificate.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/gfx/gtk_util.h" | 22 #include "ui/gfx/gtk_util.h" |
| 23 #include "ui/gfx/native_widget_types.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const char kDetailsFontFamily[] = "monospace"; | 27 const char kDetailsFontFamily[] = "monospace"; |
| 28 | 28 |
| 29 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 30 // Gtk utility functions. | 30 // Gtk utility functions. |
| 31 | 31 |
| 32 void AddTitle(GtkTable* table, int row, const std::string& text) { | 32 void AddTitle(GtkTable* table, int row, const std::string& text) { |
| 33 gtk_table_attach_defaults(table, | 33 gtk_table_attach_defaults(table, |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 ShowCertExportDialog(NULL, GTK_WINDOW(viewer->dialog_), | 700 ShowCertExportDialog(NULL, GTK_WINDOW(viewer->dialog_), |
| 701 viewer->cert_chain_list_[cert_index]); | 701 viewer->cert_chain_list_[cert_index]); |
| 702 } | 702 } |
| 703 | 703 |
| 704 void CertificateViewer::Show() { | 704 void CertificateViewer::Show() { |
| 705 gtk_util::ShowDialog(dialog_); | 705 gtk_util::ShowDialog(dialog_); |
| 706 } | 706 } |
| 707 | 707 |
| 708 } // namespace | 708 } // namespace |
| 709 | 709 |
| 710 void ShowCertificateViewer(gfx::NativeWindow parent, | 710 void ShowNativeCertificateViewer(gfx::NativeWindow parent, |
| 711 net::X509Certificate::OSCertHandle cert) { | 711 net::X509Certificate::OSCertHandle cert) { |
| 712 net::X509Certificate::OSCertHandles cert_chain; | 712 net::X509Certificate::OSCertHandles cert_chain; |
| 713 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); | 713 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); |
| 714 (new CertificateViewer(parent, cert_chain))->Show(); | 714 (new CertificateViewer(parent, cert_chain))->Show(); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void ShowCertificateViewer(gfx::NativeWindow parent, | 717 void ShowNativeCertificateViewer(gfx::NativeWindow parent, |
| 718 net::X509Certificate* cert) { | 718 net::X509Certificate* cert) { |
| 719 ShowCertificateViewer(parent, cert->os_cert_handle()); | 719 ShowNativeCertificateViewer(parent, cert->os_cert_handle()); |
| 720 } | 720 } |
| OLD | NEW |