summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 22:51:54 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 22:51:54 +0000
commitb232fc0b33f3c21a90918be4b646ccef388c9e63 (patch)
tree78f53df2e06f8873cc6a5ad80a23e5ff2c981428 /chrome/browser
parent1cb660eceb9de5b7d1ea7b97be06034c0cae8ae0 (diff)
downloadchromium_src-b232fc0b33f3c21a90918be4b646ccef388c9e63.zip
chromium_src-b232fc0b33f3c21a90918be4b646ccef388c9e63.tar.gz
chromium_src-b232fc0b33f3c21a90918be4b646ccef388c9e63.tar.bz2
Relanding the page info on Gtk Linux.
Review URL: http://codereview.chromium.org/159657 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/page_info_window_mac.mm6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc4
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc27
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h5
-rw-r--r--chrome/browser/gtk/page_info_window_gtk.cc170
-rw-r--r--chrome/browser/page_info_model.cc91
-rw-r--r--chrome/browser/page_info_model.h14
-rw-r--r--chrome/browser/page_info_window.cc63
-rw-r--r--chrome/browser/page_info_window.h84
-rw-r--r--chrome/browser/views/browser_dialogs.h11
-rw-r--r--chrome/browser/views/dialog_stubs_gtk.cc8
-rw-r--r--chrome/browser/views/frame/browser_view.cc1
-rw-r--r--chrome/browser/views/page_info_window_view.cc26
13 files changed, 291 insertions, 219 deletions
diff --git a/chrome/browser/cocoa/page_info_window_mac.mm b/chrome/browser/cocoa/page_info_window_mac.mm
index 2112059..a31f0b9 100644
--- a/chrome/browser/cocoa/page_info_window_mac.mm
+++ b/chrome/browser/cocoa/page_info_window_mac.mm
@@ -94,7 +94,7 @@ void PageInfoWindowMac::LayoutSections() {
[controller_ setIdentityImg:[controller_ goodImg]];
else
[controller_ setIdentityImg:[controller_ badImg]];
- [controller_ setIdentityMsg:base::SysWideToNSString(
+ [controller_ setIdentityMsg:base::SysUTF16ToNSString(
identity_section.description)];
// Connection section.
@@ -105,7 +105,7 @@ void PageInfoWindowMac::LayoutSections() {
else
[controller_ setConnectionImg:[controller_ badImg]];
[controller_ setConnectionMsg:
- base::SysWideToNSString(connection_section.description)];
+ base::SysUTF16ToNSString(connection_section.description)];
if (model_.GetSectionCount() > 2) {
// We have the history info.
@@ -117,7 +117,7 @@ void PageInfoWindowMac::LayoutSections() {
[controller_ setHistoryImg:[controller_ badImg]];
[controller_ setHistoryMsg:
- base::SysWideToNSString(history_section.description)];
+ base::SysUTF16ToNSString(history_section.description)];
}
// By default, assume that we don't have certificate information to show.
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index c5786dda..fff5eb7 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -53,6 +53,7 @@
#include "chrome/browser/gtk/task_manager_gtk.h"
#include "chrome/browser/gtk/toolbar_star_toggle_gtk.h"
#include "chrome/browser/location_bar.h"
+#include "chrome/browser/page_info_window.h"
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
@@ -908,8 +909,7 @@ void BrowserWindowGtk::ShowPageInfo(Profile* profile,
const GURL& url,
const NavigationEntry::SSLStatus& ssl,
bool show_history) {
- // TODO(port): port PageInfoWindow.
- NOTIMPLEMENTED() << "IDS_CONTENT_CONTEXT_VIEWFRAMEINFO";
+ browser::ShowPageInfo(window_, profile, url, ssl, show_history);
}
void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() {
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 8682c5a..f3a2618 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -15,6 +15,7 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/alternate_nav_url_fetcher.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/gtk/first_run_bubble.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
@@ -236,7 +237,16 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
kBottomMargin + kBorderThickness,
kSecurityIconPaddingLeft,
kSecurityIconPaddingRight);
- gtk_container_add(GTK_CONTAINER(security_icon_align_), security_icon_box);
+ // GtkImage is a "no window" widget and requires a GtkEventBox to receive
+ // events.
+ GtkWidget* event_box = gtk_event_box_new();
+ // Make the event box not visible so it does not paint a background.
+ gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
+ g_signal_connect(event_box, "button-press-event",
+ G_CALLBACK(&OnSecurityIconPressed), this);
+
+ gtk_container_add(GTK_CONTAINER(event_box), security_icon_box);
+ gtk_container_add(GTK_CONTAINER(security_icon_align_), event_box);
gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_align_, FALSE, FALSE, 0);
}
@@ -554,3 +564,18 @@ void LocationBarViewGtk::ShowFirstRunBubbleInternal(bool use_OEM_bubble) {
GTK_WINDOW(gtk_widget_get_toplevel(widget())),
gfx::Rect(x, y, 0, 0), use_OEM_bubble);
}
+
+// static
+gboolean LocationBarViewGtk::OnSecurityIconPressed(
+ GtkWidget* sender,
+ GdkEventButton* event,
+ LocationBarViewGtk* location_bar) {
+ TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents();
+ NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
+ if (!nav_entry) {
+ NOTREACHED();
+ return true;
+ }
+ tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true);
+ return true;
+}
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index 1ac1fa4..b5731a2 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -87,8 +87,13 @@ class LocationBarViewGtk : public AutocompleteEditController,
return reinterpret_cast<LocationBarViewGtk*>(userdata)->
HandleExpose(widget, event);
}
+
gboolean HandleExpose(GtkWidget* widget, GdkEventExpose* event);
+ static gboolean OnSecurityIconPressed(GtkWidget* sender,
+ GdkEventButton* event,
+ LocationBarViewGtk* location_bar);
+
// Set the SSL icon we should be showing.
void SetSecurityIcon(ToolbarModel::Icon icon);
diff --git a/chrome/browser/gtk/page_info_window_gtk.cc b/chrome/browser/gtk/page_info_window_gtk.cc
new file mode 100644
index 0000000..68b05b2f
--- /dev/null
+++ b/chrome/browser/gtk/page_info_window_gtk.cc
@@ -0,0 +1,170 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <gtk/gtk.h>
+
+#include "build/build_config.h"
+
+#include "app/l10n_util.h"
+#include "app/resource_bundle.h"
+#include "base/compiler_specific.h"
+#include "base/string_util.h"
+#include "chrome/browser/page_info_model.h"
+#include "chrome/browser/page_info_window.h"
+#include "chrome/common/gtk_util.h"
+#include "grit/locale_settings.h"
+#include "grit/generated_resources.h"
+
+
+namespace {
+
+class PageInfoWindowGtk : public PageInfoModel::PageInfoModelObserver {
+ public:
+ PageInfoWindowGtk(gfx::NativeWindow parent,
+ Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history);
+ ~PageInfoWindowGtk();
+
+ // PageInfoModelObserver implementation:
+ virtual void ModelChanged();
+
+ // Shows the page info window.
+ void Show();
+
+ private:
+ // Layouts the different sections retrieved from the model.
+ void InitContents();
+
+ // Returns a widget that contains the UI for the passed |section|.
+ GtkWidget* CreateSection(const PageInfoModel::SectionInfo& section);
+
+ // The model containing the different sections to display.
+ PageInfoModel model_;
+
+ // The page info dialog.
+ GtkWidget* dialog_;
+
+ // The virtual box containing the sections.
+ GtkWidget* contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageInfoWindowGtk);
+};
+
+// Close button callback.
+void OnDialogResponse(GtkDialog* dialog, gpointer data) {
+ // "Close" was clicked.
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+void OnDestroy(GtkDialog* dialog, PageInfoWindowGtk* page_info) {
+ delete page_info;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// PageInfoWindowGtk, public:
+PageInfoWindowGtk::PageInfoWindowGtk(gfx::NativeWindow parent,
+ Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history)
+ : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl,
+ show_history, this)),
+ contents_(NULL) {
+ dialog_ = gtk_dialog_new_with_buttons(
+ l10n_util::GetStringUTF8(IDS_PAGEINFO_WINDOW_TITLE).c_str(),
+ parent,
+ // Non-modal.
+ GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE,
+ NULL);
+ gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1);
+ gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
+ GtkUtil::kContentAreaSpacing);
+ GtkUtil::SetWindowIcon(GTK_WINDOW(dialog_));
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnDialogResponse), NULL);
+ g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this);
+
+ InitContents();
+}
+
+PageInfoWindowGtk::~PageInfoWindowGtk() {}
+
+void PageInfoWindowGtk::ModelChanged() {
+ InitContents();
+}
+
+GtkWidget* PageInfoWindowGtk::CreateSection(
+ const PageInfoModel::SectionInfo& section) {
+ GtkWidget* vbox = gtk_vbox_new(FALSE, GtkUtil::kControlSpacing);
+ GtkWidget* label = gtk_label_new(UTF16ToUTF8(section.title).c_str());
+
+ PangoAttrList* attributes = pango_attr_list_new();
+ pango_attr_list_insert(attributes,
+ pango_attr_weight_new(PANGO_WEIGHT_BOLD));
+ gtk_label_set_attributes(GTK_LABEL(label), attributes);
+ pango_attr_list_unref(attributes);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+
+ GtkWidget* section_box = gtk_hbox_new(FALSE, 0);
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ GtkWidget* image = gtk_image_new_from_pixbuf(section.state ?
+ rb.GetPixbufNamed(IDR_PAGEINFO_GOOD) :
+ rb.GetPixbufNamed(IDR_PAGEINFO_BAD));
+ gtk_box_pack_start(GTK_BOX(section_box), image, FALSE, FALSE,
+ GtkUtil::kControlSpacing);
+ gtk_misc_set_alignment(GTK_MISC(image), 0, 0);
+
+ GtkWidget* text_box = gtk_vbox_new(FALSE, GtkUtil::kControlSpacing);
+ if (!section.head_line.empty()) {
+ label = gtk_label_new(UTF16ToUTF8(section.head_line).c_str());
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(text_box), label , FALSE, FALSE, 0);
+ }
+ label = gtk_label_new(UTF16ToUTF8(section.description).c_str());
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_box_pack_start(GTK_BOX(text_box), label , FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(section_box), text_box , TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), section_box , TRUE, TRUE, 0);
+
+ return vbox;
+}
+
+void PageInfoWindowGtk::InitContents() {
+ if (contents_)
+ gtk_widget_destroy(contents_);
+ contents_ = gtk_vbox_new(FALSE, GtkUtil::kContentAreaSpacing);
+ for (int i = 0; i < model_.GetSectionCount(); i++) {
+ gtk_box_pack_start(GTK_BOX(contents_),
+ CreateSection(model_.GetSectionInfo(i)),
+ FALSE, FALSE, 0);
+ }
+ gtk_widget_show_all(contents_);
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), contents_);
+}
+
+void PageInfoWindowGtk::Show() {
+ gtk_widget_show(dialog_);
+}
+
+} // namespace
+
+namespace browser {
+
+void ShowPageInfo(gfx::NativeWindow parent,
+ Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history) {
+ PageInfoWindowGtk* window = new PageInfoWindowGtk(parent, profile, url,
+ ssl, show_history);
+ window->Show();
+}
+
+} // namespace browser
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc
index 427f905..43ad23c 100644
--- a/chrome/browser/page_info_model.cc
+++ b/chrome/browser/page_info_model.cc
@@ -37,17 +37,17 @@ PageInfoModel::PageInfoModel(Profile* profile,
PageInfoModelObserver* observer)
: observer_(observer) {
bool state = true;
- std::wstring head_line;
- std::wstring description;
- std::wstring connection_msg;
+ string16 head_line;
+ string16 description;
+ string16 connection_msg;
scoped_refptr<net::X509Certificate> cert;
// Identity section.
- std::wstring subject_name(UTF8ToWide(url.host()));
+ string16 subject_name(UTF8ToUTF16(url.host()));
bool empty_subject_name = false;
if (subject_name.empty()) {
subject_name.assign(
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
empty_subject_name = true;
}
if (ssl.cert_id() &&
@@ -57,57 +57,56 @@ PageInfoModel::PageInfoModel(Profile* profile,
if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) != 0) {
DCHECK(!cert->subject().organization_names.empty());
head_line =
- l10n_util::GetStringF(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
- UTF8ToWide(cert->subject().organization_names[0]),
- UTF8ToWide(url.host()));
+ l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
+ UTF8ToUTF16(cert->subject().organization_names[0]),
+ UTF8ToUTF16(url.host()));
// An EV Cert is required to have a city (localityName) and country but
// state is "if any".
DCHECK(!cert->subject().locality_name.empty());
DCHECK(!cert->subject().country_name.empty());
- std::wstring locality;
+ string16 locality;
if (!cert->subject().state_or_province_name.empty()) {
- locality = l10n_util::GetStringF(
+ locality = l10n_util::GetStringFUTF16(
IDS_PAGEINFO_ADDRESS,
- UTF8ToWide(cert->subject().locality_name),
- UTF8ToWide(cert->subject().state_or_province_name),
- UTF8ToWide(cert->subject().country_name));
+ UTF8ToUTF16(cert->subject().locality_name),
+ UTF8ToUTF16(cert->subject().state_or_province_name),
+ UTF8ToUTF16(cert->subject().country_name));
} else {
- locality = l10n_util::GetStringF(
+ locality = l10n_util::GetStringFUTF16(
IDS_PAGEINFO_PARTIAL_ADDRESS,
- UTF8ToWide(cert->subject().locality_name),
- UTF8ToWide(cert->subject().country_name));
+ UTF8ToUTF16(cert->subject().locality_name),
+ UTF8ToUTF16(cert->subject().country_name));
}
DCHECK(!cert->subject().organization_names.empty());
- description.assign(l10n_util::GetStringF(
+ description.assign(l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV,
- UTF8ToWide(cert->subject().organization_names[0]),
+ UTF8ToUTF16(cert->subject().organization_names[0]),
locality,
- UTF8ToWide(GetIssuerName(cert->issuer()))));
+ UTF8ToUTF16(GetIssuerName(cert->issuer()))));
} else {
// Non EV OK HTTPS.
if (empty_subject_name)
head_line.clear(); // Don't display any title.
else
head_line.assign(subject_name);
- std::wstring issuer_name(UTF8ToWide(GetIssuerName(cert->issuer())));
+ string16 issuer_name(UTF8ToUTF16(GetIssuerName(cert->issuer())));
if (issuer_name.empty()) {
- issuer_name.assign(
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
+ issuer_name.assign(l10n_util::GetStringUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
} else {
- description.assign(
- l10n_util::GetStringF(IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY,
- issuer_name));
+ description.assign(l10n_util::GetStringFUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name));
}
}
} else {
// Bad HTTPS.
- description.assign(
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
+ description.assign(l10n_util::GetStringUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
state = false;
}
sections_.push_back(SectionInfo(
state,
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
head_line,
description));
@@ -121,42 +120,42 @@ PageInfoModel::PageInfoModel(Profile* profile,
if (ssl.security_bits() <= 0) {
state = false;
description.assign(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
subject_name));
} else if (ssl.security_bits() < 80) {
state = false;
description.assign(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
subject_name));
} else {
description.assign(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
subject_name,
- IntToWString(ssl.security_bits())));
+ IntToString16(ssl.security_bits())));
if (ssl.has_mixed_content()) {
state = false;
description.assign(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
connection_msg,
- l10n_util::GetString(
+ l10n_util::GetStringUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_MIXED_CONTENT_WARNING)));
} else if (ssl.has_unsafe_content()) {
state = false;
description.assign(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
connection_msg,
- l10n_util::GetString(
+ l10n_util::GetStringUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_BAD_HTTPS_WARNING)));
}
}
sections_.push_back(SectionInfo(
state,
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
head_line,
description));
@@ -199,16 +198,20 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle,
if (!visited_before_today) {
sections_.push_back(SectionInfo(
false,
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
- std::wstring(),
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY)));
+ l10n_util::GetStringUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
+ string16(),
+ l10n_util::GetStringUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY)));
} else {
sections_.push_back(SectionInfo(
true,
- l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
- std::wstring(),
- l10n_util::GetStringF(IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
- base::TimeFormatShortDate(first_visit))));
+ l10n_util::GetStringUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
+ string16(),
+ l10n_util::GetStringFUTF16(
+ IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
+ WideToUTF16(base::TimeFormatShortDate(first_visit)))));
}
observer_->ModelChanged();
}
diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h
index 17c80b2..526372e 100644
--- a/chrome/browser/page_info_model.h
+++ b/chrome/browser/page_info_model.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_PAGE_INFO_MODEL_H_
#define CHROME_BROWSER_PAGE_INFO_MODEL_H_
-#include <string>
#include <vector>
+#include "base/string16.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -37,9 +37,9 @@ class PageInfoModel {
struct SectionInfo {
SectionInfo(bool state,
- const std::wstring& title,
- const std::wstring& head_line,
- const std::wstring& description)
+ const string16& title,
+ const string16& head_line,
+ const string16& description)
: state(state),
title(title),
head_line(head_line),
@@ -50,13 +50,13 @@ class PageInfoModel {
// unverified identity over HTTPS).
// The title of the section.
- std::wstring title;
+ string16 title;
// A single line describing the section, optional.
- std::wstring head_line;
+ string16 head_line;
// The full description of what this section is.
- std::wstring description;
+ string16 description;
};
PageInfoModel(Profile* profile,
diff --git a/chrome/browser/page_info_window.cc b/chrome/browser/page_info_window.cc
deleted file mode 100644
index c18ef06..0000000
--- a/chrome/browser/page_info_window.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/page_info_window.h"
-
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
-
-PageInfoWindow::PageInfoWindow() : cert_id_(0) {
-}
-
-PageInfoWindow::~PageInfoWindow() {
-}
-
-#if defined(OS_LINUX)
-// TODO(rsesek): Remove once we have a PageInfoWindowLinux implementation
-PageInfoWindow* PageInfoWindow::Factory() {
- NOTIMPLEMENTED();
- return NULL;
-}
-#endif
-
-// static
-void PageInfoWindow::CreatePageInfo(Profile* profile,
- NavigationEntry* nav_entry,
- gfx::NativeView parent,
- PageInfoWindow::TabID tab) {
- PageInfoWindow* window = Factory();
- window->Init(profile, nav_entry->url(), nav_entry->ssl(),
- nav_entry->page_type(), true, parent);
- window->Show();
-}
-
-// static
-void PageInfoWindow::CreateFrameInfo(Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- gfx::NativeView parent,
- TabID tab) {
- PageInfoWindow* window = Factory();
- window->Init(profile, url, ssl, NavigationEntry::NORMAL_PAGE,
- false, parent);
- window->Show();
-}
-
-// static
-void PageInfoWindow::RegisterPrefs(PrefService* prefs) {
- prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement);
-}
-
-// static
-std::string PageInfoWindow::GetIssuerName(
- const net::X509Certificate::Principal& issuer) {
- if (!issuer.common_name.empty())
- return issuer.common_name;
- if (!issuer.organization_names.empty())
- return issuer.organization_names[0];
- if (!issuer.organization_unit_names.empty())
- return issuer.organization_unit_names[0];
-
- return std::string();
-}
diff --git a/chrome/browser/page_info_window.h b/chrome/browser/page_info_window.h
index c39bd38..737c884 100644
--- a/chrome/browser/page_info_window.h
+++ b/chrome/browser/page_info_window.h
@@ -1,80 +1,28 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PAGE_INFO_WINDOW_H__
-#define CHROME_BROWSER_PAGE_INFO_WINDOW_H__
+#ifndef CHROME_BROWSER_PAGE_INFO_WINDOW_H_
+#define CHROME_BROWSER_PAGE_INFO_WINDOW_H_
#include "base/gfx/native_widget_types.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/x509_certificate.h"
-// The page info window displays information regarding the current page,
-// including security information.
-
-class NavigationEntry;
-class PageInfoContentView;
-class PrefService;
class Profile;
+class GURL;
-class PageInfoWindow {
- public:
- enum TabID {
- GENERAL = 0,
- SECURITY,
- };
-
- // Factory method to get a new platform impl of PageInfoWindow
- static PageInfoWindow* Factory();
-
- // Creates and shows a new page info window for the main page.
- static void CreatePageInfo(Profile* profile,
- NavigationEntry* nav_entry,
- gfx::NativeView parent,
- TabID tab);
-
- // Creates and shows a new page info window for the frame at |url| with the
- // specified SSL information.
- static void CreateFrameInfo(Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- gfx::NativeView parent,
- TabID tab);
-
- static void RegisterPrefs(PrefService* prefs);
-
- PageInfoWindow();
- virtual ~PageInfoWindow();
-
- // This is the main initializer that creates the window.
- virtual void Init(Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- NavigationEntry::PageType page_type,
- bool show_history,
- gfx::NativeView parent) = 0;
-
- // Brings the page info window to the foreground.
- virtual void Show() = 0;
-
- // Shows various information for the specified certificate in a new dialog.
- // This can be implemented as an individual window (like on Windows), or as
- // a modal dialog/sheet (on Mac). Either will work since we're only expecting
- // one certificate per page.
- virtual void ShowCertDialog(int cert_id) = 0;
-
- protected:
- // Returns a name that can be used to represent the issuer. It tries in this
- // order CN, O and OU and returns the first non-empty one found.
- static std::string GetIssuerName(
- const net::X509Certificate::Principal& issuer);
+namespace browser {
- // The id of the server cert for this page (0 means no cert).
- int cert_id_;
+// Shows the page info using the specified information.
+// |url| is the url of the page/frame the info applies to, |ssl| is the SSL
+// information for that page/frame. If |show_history| is true, a section
+// showing how many times that URL has been visited is added to the page info.
+void ShowPageInfo(gfx::NativeWindow parent,
+ Profile* profile,
+ const GURL& url,
+ const NavigationEntry::SSLStatus& ssl,
+ bool show_history);
- private:
- DISALLOW_COPY_AND_ASSIGN(PageInfoWindow);
-};
+} // namespace browser
-#endif // #define CHROME_BROWSER_PAGE_INFO_WINDOW_H__
+#endif // CHROME_BROWSER_PAGE_INFO_WINDOW_H_
diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h
index 8806976..c2b13f3 100644
--- a/chrome/browser/views/browser_dialogs.h
+++ b/chrome/browser/views/browser_dialogs.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_VIEWS_BROWSER_DIALOGS_H_
#include "base/gfx/native_widget_types.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
// This file contains functions for running a variety of browser dialogs and
// popups. The dialogs here are the ones that the caller does not need to
@@ -98,16 +97,6 @@ void EditSearchEngine(gfx::NativeWindow parent,
EditSearchEngineControllerDelegate* delegate,
Profile* profile);
-// Shows the page info using the specified information.
-// |url| is the url of the page/frame the info applies to, |ssl| is the SSL
-// information for that page/frame. If |show_history| is true, a section
-// showing how many times that URL has been visited is added to the page info.
-void ShowPageInfo(gfx::NativeWindow parent,
- Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- bool show_history);
-
} // namespace browser
#endif // CHROME_BROWSER_VIEWS_BROWSER_DIALOGS_H_
diff --git a/chrome/browser/views/dialog_stubs_gtk.cc b/chrome/browser/views/dialog_stubs_gtk.cc
index 7c1b15d..3a482ee 100644
--- a/chrome/browser/views/dialog_stubs_gtk.cc
+++ b/chrome/browser/views/dialog_stubs_gtk.cc
@@ -92,14 +92,6 @@ void EditSearchEngine(gfx::NativeWindow parent,
NOTIMPLEMENTED();
}
-void ShowPageInfo(gfx::NativeView parent,
- Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- bool show_history) {
- NOTIMPLEMENTED();
-}
-
} // namespace browser
void ShowOptionsWindow(OptionsPage page,
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 1de6e48..d4fc97e 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -30,6 +30,7 @@
#if defined(OS_WIN)
#include "chrome/browser/jumplist.h"
#endif
+#include "chrome/browser/page_info_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc
index 4e3b020..987552b6 100644
--- a/chrome/browser/views/page_info_window_view.cc
+++ b/chrome/browser/views/page_info_window_view.cc
@@ -13,8 +13,10 @@
#include "app/resource_bundle.h"
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
+#include "base/string_util.h"
#include "chrome/browser/cert_store.h"
#include "chrome/browser/page_info_model.h"
+#include "chrome/browser/page_info_window.h"
#include "chrome/common/pref_names.h"
#include "grit/locale_settings.h"
#include "grit/generated_resources.h"
@@ -109,10 +111,10 @@ class PageInfoWindowView : public views::View,
// optional head-line (in bold) and a description.
class Section : public views::View {
public:
- Section(const std::wstring& title,
+ Section(const string16& title,
bool state,
- const std::wstring& head_line,
- const std::wstring& description);
+ const string16& head_line,
+ const string16& description);
virtual ~Section();
virtual int GetHeightForWidth(int w);
@@ -120,16 +122,16 @@ class Section : public views::View {
private:
// The text placed on top of the section (on the left of the separator bar).
- std::wstring title_;
+ string16 title_;
// Whether to show the good/bad icon.
bool state_;
// The first line of the description, show in bold.
- std::wstring head_line_;
+ string16 head_line_;
// The description, displayed below the head line.
- std::wstring description_;
+ string16 description_;
static SkBitmap* good_state_icon_;
static SkBitmap* bad_state_icon_;
@@ -361,10 +363,10 @@ void PageInfoWindowView::ShowCertDialog(int cert_id) {
////////////////////////////////////////////////////////////////////////////////
// Section
-Section::Section(const std::wstring& title,
+Section::Section(const string16& title,
bool state,
- const std::wstring& head_line,
- const std::wstring& description)
+ const string16& head_line,
+ const string16& description)
: title_(title),
state_(state),
head_line_(head_line),
@@ -374,7 +376,7 @@ Section::Section(const std::wstring& title,
good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD);
bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_BAD);
}
- title_label_ = new views::Label(title);
+ title_label_ = new views::Label(UTF16ToWideHack(title));
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(title_label_);
@@ -389,13 +391,13 @@ Section::Section(const std::wstring& title,
status_image_->SetImage(state ? good_state_icon_ : bad_state_icon_);
AddChildView(status_image_);
- head_line_label_ = new views::Label(head_line);
+ head_line_label_ = new views::Label(UTF16ToWideHack(head_line));
head_line_label_->SetFont(
head_line_label_->GetFont().DeriveFont(0, gfx::Font::BOLD));
head_line_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(head_line_label_);
- description_label_ = new views::Label(description);
+ description_label_ = new views::Label(UTF16ToWideHack(description));
description_label_->SetMultiLine(true);
description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(description_label_);