summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/page_info_window_gtk.cc
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 22:36:35 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 22:36:35 +0000
commit1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88 (patch)
treec3617b3e5e0590ed2f01096929ddbb0edac000e2 /chrome/browser/gtk/page_info_window_gtk.cc
parent7105ea549a113d4c1d473c305475caa0a866e286 (diff)
downloadchromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.zip
chromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.tar.gz
chromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.tar.bz2
Linux: Add Certificate Info dialog (part 1)
Rename base/nss_init.{h,cc} to base/nss_util.{h,cc}, move PRTimeToBaseTime there. BUG=18119 TEST=Load https://www.google.com, compare to firefox cert dialog. Review URL: http://codereview.chromium.org/500141 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/page_info_window_gtk.cc')
-rw-r--r--chrome/browser/gtk/page_info_window_gtk.cc46
1 files changed, 40 insertions, 6 deletions
diff --git a/chrome/browser/gtk/page_info_window_gtk.cc b/chrome/browser/gtk/page_info_window_gtk.cc
index d6cb526..81ab056 100644
--- a/chrome/browser/gtk/page_info_window_gtk.cc
+++ b/chrome/browser/gtk/page_info_window_gtk.cc
@@ -10,6 +10,7 @@
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
#include "base/string_util.h"
+#include "chrome/browser/gtk/certificate_viewer.h"
#include "chrome/browser/page_info_model.h"
#include "chrome/browser/page_info_window.h"
#include "chrome/common/gtk_util.h"
@@ -19,6 +20,10 @@
namespace {
+enum {
+ RESPONSE_SHOW_CERT_INFO = 0,
+};
+
class PageInfoWindowGtk : public PageInfoModel::PageInfoModelObserver {
public:
PageInfoWindowGtk(gfx::NativeWindow parent,
@@ -34,6 +39,9 @@ class PageInfoWindowGtk : public PageInfoModel::PageInfoModelObserver {
// Shows the page info window.
void Show();
+ // Shows the certificate info window.
+ void ShowCertDialog();
+
private:
// Layouts the different sections retrieved from the model.
void InitContents();
@@ -50,13 +58,21 @@ class PageInfoWindowGtk : public PageInfoModel::PageInfoModelObserver {
// The virtual box containing the sections.
GtkWidget* contents_;
+ // The id of the certificate for this page.
+ int cert_id_;
+
DISALLOW_COPY_AND_ASSIGN(PageInfoWindowGtk);
};
-// Close button callback.
-void OnDialogResponse(GtkDialog* dialog, gpointer data) {
- // "Close" was clicked.
- gtk_widget_destroy(GTK_WIDGET(dialog));
+// Button callbacks.
+void OnDialogResponse(GtkDialog* dialog, gint response_id,
+ PageInfoWindowGtk* page_info) {
+ if (response_id == RESPONSE_SHOW_CERT_INFO) {
+ page_info->ShowCertDialog();
+ } else {
+ // "Close" was clicked.
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ }
}
void OnDestroy(GtkDialog* dialog, PageInfoWindowGtk* page_info) {
@@ -72,7 +88,8 @@ PageInfoWindowGtk::PageInfoWindowGtk(gfx::NativeWindow parent,
bool show_history)
: ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl,
show_history, this)),
- contents_(NULL) {
+ contents_(NULL),
+ cert_id_(ssl.cert_id()) {
dialog_ = gtk_dialog_new_with_buttons(
l10n_util::GetStringUTF8(IDS_PAGEINFO_WINDOW_TITLE).c_str(),
parent,
@@ -81,9 +98,22 @@ PageInfoWindowGtk::PageInfoWindowGtk(gfx::NativeWindow parent,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_CLOSE);
+
+ if (cert_id_) {
+ GtkWidget* cert_info_button = gtk_dialog_add_button(
+ GTK_DIALOG(dialog_),
+ l10n_util::GetStringUTF8(IDS_PAGEINFO_CERT_INFO_BUTTON).c_str(),
+ RESPONSE_SHOW_CERT_INFO);
+ gtk_button_box_set_child_secondary(
+ GTK_BUTTON_BOX(GTK_DIALOG(dialog_)->action_area),
+ cert_info_button,
+ TRUE);
+ }
+
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
gtk_util::kContentAreaSpacing);
- g_signal_connect(dialog_, "response", G_CALLBACK(OnDialogResponse), NULL);
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnDialogResponse), this);
g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this);
InitContents();
@@ -152,6 +182,10 @@ void PageInfoWindowGtk::Show() {
gtk_widget_show(dialog_);
}
+void PageInfoWindowGtk::ShowCertDialog() {
+ ShowCertificateViewer(GTK_WINDOW(dialog_), cert_id_);
+}
+
} // namespace
namespace browser {