Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/ui/gtk/certificate_viewer_gtk.cc

Issue 10406014: Add a ScopedPangoFontDescription helper class and use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <pango/pango-font.h> 6 #include <pango/pango-font.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/certificate_viewer.h" 16 #include "chrome/browser/certificate_viewer.h"
17 #include "chrome/browser/ui/certificate_dialogs.h" 17 #include "chrome/browser/ui/certificate_dialogs.h"
18 #include "chrome/browser/ui/gtk/gtk_util.h" 18 #include "chrome/browser/ui/gtk/gtk_util.h"
19 #include "chrome/common/net/x509_certificate_model.h" 19 #include "chrome/common/net/x509_certificate_model.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "net/base/x509_certificate.h" 21 #include "net/base/x509_certificate.h"
22 #include "ui/base/gtk/gtk_hig_constants.h" 22 #include "ui/base/gtk/gtk_hig_constants.h"
23 #include "ui/base/gtk/menu_label_accelerator_util.h" 23 #include "ui/base/gtk/menu_label_accelerator_util.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gfx/pango_util.h"
26 27
27 namespace { 28 namespace {
28 29
29 const char kDetailsFontFamily[] = "monospace"; 30 const char kDetailsFontFamily[] = "monospace";
30 31
31 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
32 // Gtk utility functions. 33 // Gtk utility functions.
33 34
34 void AddTitle(GtkTable* table, int row, const std::string& text) { 35 void AddTitle(GtkTable* table, int row, const std::string& text) {
35 gtk_table_attach_defaults(table, 36 gtk_table_attach_defaults(table,
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(value_scroll_window), 629 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(value_scroll_window),
629 GTK_POLICY_AUTOMATIC, 630 GTK_POLICY_AUTOMATIC,
630 GTK_POLICY_AUTOMATIC); 631 GTK_POLICY_AUTOMATIC);
631 gtk_scrolled_window_set_shadow_type( 632 gtk_scrolled_window_set_shadow_type(
632 GTK_SCROLLED_WINDOW(value_scroll_window), GTK_SHADOW_ETCHED_IN); 633 GTK_SCROLLED_WINDOW(value_scroll_window), GTK_SHADOW_ETCHED_IN);
633 gtk_container_add(GTK_CONTAINER(value_scroll_window), field_value_view); 634 gtk_container_add(GTK_CONTAINER(value_scroll_window), field_value_view);
634 gtk_box_pack_start(GTK_BOX(value_vbox), 635 gtk_box_pack_start(GTK_BOX(value_vbox),
635 value_scroll_window, TRUE, TRUE, 0); 636 value_scroll_window, TRUE, TRUE, 0);
636 637
637 gtk_widget_ensure_style(field_value_view); 638 gtk_widget_ensure_style(field_value_view);
638 PangoFontDescription* font_desc = pango_font_description_copy( 639 gfx::ScopedPangoFontDescription font_desc(pango_font_description_copy(
639 gtk_widget_get_style(field_value_view)->font_desc); 640 gtk_widget_get_style(field_value_view)->font_desc));
640 pango_font_description_set_family(font_desc, kDetailsFontFamily); 641 pango_font_description_set_family(font_desc.get(), kDetailsFontFamily);
641 gtk_widget_modify_font(field_value_view, font_desc); 642 gtk_widget_modify_font(field_value_view, font_desc.get());
642 pango_font_description_free(font_desc);
643 643
644 GtkWidget* export_hbox = gtk_hbox_new(FALSE, 0); 644 GtkWidget* export_hbox = gtk_hbox_new(FALSE, 0);
645 gtk_box_pack_start(GTK_BOX(details_page_vbox_), export_hbox, 645 gtk_box_pack_start(GTK_BOX(details_page_vbox_), export_hbox,
646 FALSE, FALSE, 0); 646 FALSE, FALSE, 0);
647 export_button_ = gtk_button_new_with_mnemonic( 647 export_button_ = gtk_button_new_with_mnemonic(
648 ui::ConvertAcceleratorsFromWindowsStyle( 648 ui::ConvertAcceleratorsFromWindowsStyle(
649 l10n_util::GetStringUTF8( 649 l10n_util::GetStringUTF8(
650 IDS_CERT_DETAILS_EXPORT_CERTIFICATE)).c_str()); 650 IDS_CERT_DETAILS_EXPORT_CERTIFICATE)).c_str());
651 g_signal_connect(export_button_, "clicked", 651 g_signal_connect(export_button_, "clicked",
652 G_CALLBACK(OnExportClicked), this); 652 G_CALLBACK(OnExportClicked), this);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 void CertificateViewer::Show() { 717 void CertificateViewer::Show() {
718 gtk_util::ShowDialog(dialog_); 718 gtk_util::ShowDialog(dialog_);
719 } 719 }
720 720
721 } // namespace 721 } // namespace
722 722
723 void ShowCertificateViewer(gfx::NativeWindow parent, 723 void ShowCertificateViewer(gfx::NativeWindow parent,
724 net::X509Certificate* cert) { 724 net::X509Certificate* cert) {
725 (new CertificateViewer(parent, cert))->Show(); 725 (new CertificateViewer(parent, cert))->Show();
726 } 726 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698