| 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/certificate_viewer.h" | 15 #include "chrome/browser/certificate_viewer.h" |
| 16 #include "chrome/browser/ui/certificate_dialogs.h" | 16 #include "chrome/browser/ui/certificate_dialogs.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/common/net/x509_certificate_model.h" | 18 #include "chrome/common/net/x509_certificate_model.h" |
| 19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 20 #include "net/base/x509_certificate.h" | 20 #include "net/base/x509_certificate.h" |
| 21 #include "ui/base/gtk/gtk_hig_constants.h" | 21 #include "ui/base/gtk/gtk_hig_constants.h" |
| 22 #include "ui/base/gtk/menu_label_accelerator_util.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/gfx/linux_util.h" | |
| 24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kDetailsFontFamily[] = "monospace"; | 28 const char kDetailsFontFamily[] = "monospace"; |
| 29 | 29 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 31 // Gtk utility functions. | 31 // Gtk utility functions. |
| 32 | 32 |
| 33 void AddTitle(GtkTable* table, int row, const std::string& text) { | 33 void AddTitle(GtkTable* table, int row, const std::string& text) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 InitGeneralPage(); | 156 InitGeneralPage(); |
| 157 InitDetailsPage(); | 157 InitDetailsPage(); |
| 158 | 158 |
| 159 notebook_ = gtk_notebook_new(); | 159 notebook_ = gtk_notebook_new(); |
| 160 gtk_container_add(GTK_CONTAINER(content_area), notebook_); | 160 gtk_container_add(GTK_CONTAINER(content_area), notebook_); |
| 161 | 161 |
| 162 gtk_notebook_append_page( | 162 gtk_notebook_append_page( |
| 163 GTK_NOTEBOOK(notebook_), | 163 GTK_NOTEBOOK(notebook_), |
| 164 general_page_vbox_, | 164 general_page_vbox_, |
| 165 gtk_label_new_with_mnemonic( | 165 gtk_label_new_with_mnemonic( |
| 166 gfx::ConvertAcceleratorsFromWindowsStyle( | 166 ui::ConvertAcceleratorsFromWindowsStyle( |
| 167 l10n_util::GetStringUTF8( | 167 l10n_util::GetStringUTF8( |
| 168 IDS_CERT_INFO_GENERAL_TAB_LABEL)).c_str())); | 168 IDS_CERT_INFO_GENERAL_TAB_LABEL)).c_str())); |
| 169 | 169 |
| 170 gtk_notebook_append_page( | 170 gtk_notebook_append_page( |
| 171 GTK_NOTEBOOK(notebook_), | 171 GTK_NOTEBOOK(notebook_), |
| 172 details_page_vbox_, | 172 details_page_vbox_, |
| 173 gtk_label_new_with_mnemonic( | 173 gtk_label_new_with_mnemonic( |
| 174 gfx::ConvertAcceleratorsFromWindowsStyle( | 174 ui::ConvertAcceleratorsFromWindowsStyle( |
| 175 l10n_util::GetStringUTF8( | 175 l10n_util::GetStringUTF8( |
| 176 IDS_CERT_INFO_DETAILS_TAB_LABEL)).c_str())); | 176 IDS_CERT_INFO_DETAILS_TAB_LABEL)).c_str())); |
| 177 | 177 |
| 178 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), NULL); | 178 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), NULL); |
| 179 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this); | 179 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this); |
| 180 } | 180 } |
| 181 | 181 |
| 182 CertificateViewer::~CertificateViewer() { | 182 CertificateViewer::~CertificateViewer() { |
| 183 x509_certificate_model::DestroyCertChain(&cert_chain_list_); | 183 x509_certificate_model::DestroyCertChain(&cert_chain_list_); |
| 184 } | 184 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 PangoFontDescription* font_desc = pango_font_description_copy( | 627 PangoFontDescription* font_desc = pango_font_description_copy( |
| 628 gtk_widget_get_style(field_value_view)->font_desc); | 628 gtk_widget_get_style(field_value_view)->font_desc); |
| 629 pango_font_description_set_family(font_desc, kDetailsFontFamily); | 629 pango_font_description_set_family(font_desc, kDetailsFontFamily); |
| 630 gtk_widget_modify_font(field_value_view, font_desc); | 630 gtk_widget_modify_font(field_value_view, font_desc); |
| 631 pango_font_description_free(font_desc); | 631 pango_font_description_free(font_desc); |
| 632 | 632 |
| 633 GtkWidget* export_hbox = gtk_hbox_new(FALSE, 0); | 633 GtkWidget* export_hbox = gtk_hbox_new(FALSE, 0); |
| 634 gtk_box_pack_start(GTK_BOX(details_page_vbox_), export_hbox, | 634 gtk_box_pack_start(GTK_BOX(details_page_vbox_), export_hbox, |
| 635 FALSE, FALSE, 0); | 635 FALSE, FALSE, 0); |
| 636 export_button_ = gtk_button_new_with_mnemonic( | 636 export_button_ = gtk_button_new_with_mnemonic( |
| 637 gfx::ConvertAcceleratorsFromWindowsStyle( | 637 ui::ConvertAcceleratorsFromWindowsStyle( |
| 638 l10n_util::GetStringUTF8( | 638 l10n_util::GetStringUTF8( |
| 639 IDS_CERT_DETAILS_EXPORT_CERTIFICATE)).c_str()); | 639 IDS_CERT_DETAILS_EXPORT_CERTIFICATE)).c_str()); |
| 640 g_signal_connect(export_button_, "clicked", | 640 g_signal_connect(export_button_, "clicked", |
| 641 G_CALLBACK(OnExportClicked), this); | 641 G_CALLBACK(OnExportClicked), this); |
| 642 gtk_box_pack_start(GTK_BOX(export_hbox), export_button_, | 642 gtk_box_pack_start(GTK_BOX(export_hbox), export_button_, |
| 643 FALSE, FALSE, 0); | 643 FALSE, FALSE, 0); |
| 644 | 644 |
| 645 // Select the initial certificate in the hierarchy. | 645 // Select the initial certificate in the hierarchy. |
| 646 gtk_tree_selection_select_iter(hierarchy_selection_, &hierarchy_leaf_iter); | 646 gtk_tree_selection_select_iter(hierarchy_selection_, &hierarchy_leaf_iter); |
| 647 } | 647 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 net::X509Certificate::OSCertHandle cert) { | 713 net::X509Certificate::OSCertHandle cert) { |
| 714 net::X509Certificate::OSCertHandles cert_chain; | 714 net::X509Certificate::OSCertHandles cert_chain; |
| 715 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); | 715 x509_certificate_model::GetCertChainFromCert(cert, &cert_chain); |
| 716 (new CertificateViewer(parent, cert_chain))->Show(); | 716 (new CertificateViewer(parent, cert_chain))->Show(); |
| 717 } | 717 } |
| 718 | 718 |
| 719 void ShowCertificateViewer(gfx::NativeWindow parent, | 719 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 720 net::X509Certificate* cert) { | 720 net::X509Certificate* cert) { |
| 721 ShowCertificateViewer(parent, cert->os_cert_handle()); | 721 ShowCertificateViewer(parent, cert->os_cert_handle()); |
| 722 } | 722 } |
| OLD | NEW |