| 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" | 5 #include "chrome/browser/ui/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 GtkTextBuffer* field_value_buffer_; | 114 GtkTextBuffer* field_value_buffer_; |
| 115 GtkWidget* export_button_; | 115 GtkWidget* export_button_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(CertificateViewer); | 117 DISALLOW_COPY_AND_ASSIGN(CertificateViewer); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 //////////////////////////////////////////////////////////////////////////////// | 120 //////////////////////////////////////////////////////////////////////////////// |
| 121 // CertificateViewer implementation. | 121 // CertificateViewer implementation. |
| 122 | 122 |
| 123 // Close button callback. | 123 // Close button callback. |
| 124 void OnDialogResponse(GtkDialog* dialog, gint response_id, | 124 void OnResponse(GtkWidget* dialog, int response_id) { |
| 125 gpointer user_data) { | |
| 126 // "Close" was clicked. | 125 // "Close" was clicked. |
| 127 gtk_widget_destroy(GTK_WIDGET(dialog)); | 126 gtk_widget_destroy(dialog); |
| 128 } | 127 } |
| 129 | 128 |
| 130 void OnDestroy(GtkDialog* dialog, CertificateViewer* cert_viewer) { | 129 void OnDestroy(GtkDialog* dialog, CertificateViewer* cert_viewer) { |
| 131 delete cert_viewer; | 130 delete cert_viewer; |
| 132 } | 131 } |
| 133 | 132 |
| 134 CertificateViewer::CertificateViewer( | 133 CertificateViewer::CertificateViewer( |
| 135 gfx::NativeWindow parent, | 134 gfx::NativeWindow parent, |
| 136 const net::X509Certificate::OSCertHandles& cert_chain_list) | 135 const net::X509Certificate::OSCertHandles& cert_chain_list) |
| 137 : cert_chain_list_(cert_chain_list) { | 136 : cert_chain_list_(cert_chain_list) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 166 IDS_CERT_INFO_GENERAL_TAB_LABEL)).c_str())); | 165 IDS_CERT_INFO_GENERAL_TAB_LABEL)).c_str())); |
| 167 | 166 |
| 168 gtk_notebook_append_page( | 167 gtk_notebook_append_page( |
| 169 GTK_NOTEBOOK(notebook_), | 168 GTK_NOTEBOOK(notebook_), |
| 170 details_page_vbox_, | 169 details_page_vbox_, |
| 171 gtk_label_new_with_mnemonic( | 170 gtk_label_new_with_mnemonic( |
| 172 gfx::ConvertAcceleratorsFromWindowsStyle( | 171 gfx::ConvertAcceleratorsFromWindowsStyle( |
| 173 l10n_util::GetStringUTF8( | 172 l10n_util::GetStringUTF8( |
| 174 IDS_CERT_INFO_DETAILS_TAB_LABEL)).c_str())); | 173 IDS_CERT_INFO_DETAILS_TAB_LABEL)).c_str())); |
| 175 | 174 |
| 176 g_signal_connect(dialog_, "response", G_CALLBACK(OnDialogResponse), NULL); | 175 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), NULL); |
| 177 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this); | 176 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this); |
| 178 } | 177 } |
| 179 | 178 |
| 180 CertificateViewer::~CertificateViewer() { | 179 CertificateViewer::~CertificateViewer() { |
| 181 x509_certificate_model::DestroyCertChain(&cert_chain_list_); | 180 x509_certificate_model::DestroyCertChain(&cert_chain_list_); |
| 182 } | 181 } |
| 183 | 182 |
| 184 void CertificateViewer::InitGeneralPage() { | 183 void CertificateViewer::InitGeneralPage() { |
| 185 net::X509Certificate::OSCertHandle cert = cert_chain_list_.front(); | 184 net::X509Certificate::OSCertHandle cert = cert_chain_list_.front(); |
| 186 general_page_vbox_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaSpacing); | 185 general_page_vbox_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaSpacing); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 net::X509Certificate::OSCertHandle cert) { | 684 net::X509Certificate::OSCertHandle cert) { |
| 686 net::X509Certificate::OSCertHandles cert_chain; | 685 net::X509Certificate::OSCertHandles cert_chain; |
| 687 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); | 686 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); |
| 688 (new CertificateViewer(parent, cert_chain))->Show(); | 687 (new CertificateViewer(parent, cert_chain))->Show(); |
| 689 } | 688 } |
| 690 | 689 |
| 691 void ShowCertificateViewer(gfx::NativeWindow parent, | 690 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 692 net::X509Certificate* cert) { | 691 net::X509Certificate* cert) { |
| 693 ShowCertificateViewer(parent, cert->os_cert_handle()); | 692 ShowCertificateViewer(parent, cert->os_cert_handle()); |
| 694 } | 693 } |
| OLD | NEW |