summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 18:24:56 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 18:24:56 +0000
commit6fbdc9ca2946e7841adf64e7b8bb9999d8810301 (patch)
tree6b8df37c7d52fbce42354ebf53f141da30f4f660 /chrome
parentf0037f16b1ce3bdecd6b99caff499f6ed5b6ef6a (diff)
downloadchromium_src-6fbdc9ca2946e7841adf64e7b8bb9999d8810301.zip
chromium_src-6fbdc9ca2946e7841adf64e7b8bb9999d8810301.tar.gz
chromium_src-6fbdc9ca2946e7841adf64e7b8bb9999d8810301.tar.bz2
Reverting 22070.
Review URL: http://codereview.chromium.org/159645 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22071 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-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/frame/browser_view.cc1
-rw-r--r--chrome/browser/views/page_info_window_view.cc27
-rw-r--r--chrome/chrome.gyp1
13 files changed, 212 insertions, 292 deletions
diff --git a/chrome/browser/cocoa/page_info_window_mac.mm b/chrome/browser/cocoa/page_info_window_mac.mm
index a31f0b9..2112059 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::SysUTF16ToNSString(
+ [controller_ setIdentityMsg:base::SysWideToNSString(
identity_section.description)];
// Connection section.
@@ -105,7 +105,7 @@ void PageInfoWindowMac::LayoutSections() {
else
[controller_ setConnectionImg:[controller_ badImg]];
[controller_ setConnectionMsg:
- base::SysUTF16ToNSString(connection_section.description)];
+ base::SysWideToNSString(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::SysUTF16ToNSString(history_section.description)];
+ base::SysWideToNSString(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 fff5eb7..c5786dda 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -53,7 +53,6 @@
#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"
@@ -909,7 +908,8 @@ void BrowserWindowGtk::ShowPageInfo(Profile* profile,
const GURL& url,
const NavigationEntry::SSLStatus& ssl,
bool show_history) {
- browser::ShowPageInfo(window_, profile, url, ssl, show_history);
+ // TODO(port): port PageInfoWindow.
+ NOTIMPLEMENTED() << "IDS_CONTENT_CONTEXT_VIEWFRAMEINFO";
}
void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() {
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index f3a2618..8682c5a 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -15,7 +15,6 @@
#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"
@@ -237,16 +236,7 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
kBottomMargin + kBorderThickness,
kSecurityIconPaddingLeft,
kSecurityIconPaddingRight);
- // 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_container_add(GTK_CONTAINER(security_icon_align_), security_icon_box);
gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_align_, FALSE, FALSE, 0);
}
@@ -564,18 +554,3 @@ 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 b5731a2..1ac1fa4 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -87,13 +87,8 @@ 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
deleted file mode 100644
index 68b05b2f..0000000
--- a/chrome/browser/gtk/page_info_window_gtk.cc
+++ /dev/null
@@ -1,170 +0,0 @@
-// 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 43ad23c..427f905 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;
- string16 head_line;
- string16 description;
- string16 connection_msg;
+ std::wstring head_line;
+ std::wstring description;
+ std::wstring connection_msg;
scoped_refptr<net::X509Certificate> cert;
// Identity section.
- string16 subject_name(UTF8ToUTF16(url.host()));
+ std::wstring subject_name(UTF8ToWide(url.host()));
bool empty_subject_name = false;
if (subject_name.empty()) {
subject_name.assign(
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
empty_subject_name = true;
}
if (ssl.cert_id() &&
@@ -57,56 +57,57 @@ PageInfoModel::PageInfoModel(Profile* profile,
if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) != 0) {
DCHECK(!cert->subject().organization_names.empty());
head_line =
- l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
- UTF8ToUTF16(cert->subject().organization_names[0]),
- UTF8ToUTF16(url.host()));
+ l10n_util::GetStringF(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
+ UTF8ToWide(cert->subject().organization_names[0]),
+ UTF8ToWide(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());
- string16 locality;
+ std::wstring locality;
if (!cert->subject().state_or_province_name.empty()) {
- locality = l10n_util::GetStringFUTF16(
+ locality = l10n_util::GetStringF(
IDS_PAGEINFO_ADDRESS,
- UTF8ToUTF16(cert->subject().locality_name),
- UTF8ToUTF16(cert->subject().state_or_province_name),
- UTF8ToUTF16(cert->subject().country_name));
+ UTF8ToWide(cert->subject().locality_name),
+ UTF8ToWide(cert->subject().state_or_province_name),
+ UTF8ToWide(cert->subject().country_name));
} else {
- locality = l10n_util::GetStringFUTF16(
+ locality = l10n_util::GetStringF(
IDS_PAGEINFO_PARTIAL_ADDRESS,
- UTF8ToUTF16(cert->subject().locality_name),
- UTF8ToUTF16(cert->subject().country_name));
+ UTF8ToWide(cert->subject().locality_name),
+ UTF8ToWide(cert->subject().country_name));
}
DCHECK(!cert->subject().organization_names.empty());
- description.assign(l10n_util::GetStringFUTF16(
+ description.assign(l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV,
- UTF8ToUTF16(cert->subject().organization_names[0]),
+ UTF8ToWide(cert->subject().organization_names[0]),
locality,
- UTF8ToUTF16(GetIssuerName(cert->issuer()))));
+ UTF8ToWide(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);
- string16 issuer_name(UTF8ToUTF16(GetIssuerName(cert->issuer())));
+ std::wstring issuer_name(UTF8ToWide(GetIssuerName(cert->issuer())));
if (issuer_name.empty()) {
- issuer_name.assign(l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
+ issuer_name.assign(
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
} else {
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name));
+ description.assign(
+ l10n_util::GetStringF(IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY,
+ issuer_name));
}
}
} else {
// Bad HTTPS.
- description.assign(l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
+ description.assign(
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
state = false;
}
sections_.push_back(SectionInfo(
state,
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
head_line,
description));
@@ -120,42 +121,42 @@ PageInfoModel::PageInfoModel(Profile* profile,
if (ssl.security_bits() <= 0) {
state = false;
description.assign(
- l10n_util::GetStringFUTF16(
+ l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
subject_name));
} else if (ssl.security_bits() < 80) {
state = false;
description.assign(
- l10n_util::GetStringFUTF16(
+ l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
subject_name));
} else {
description.assign(
- l10n_util::GetStringFUTF16(
+ l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
subject_name,
- IntToString16(ssl.security_bits())));
+ IntToWString(ssl.security_bits())));
if (ssl.has_mixed_content()) {
state = false;
description.assign(
- l10n_util::GetStringFUTF16(
+ l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
connection_msg,
- l10n_util::GetStringUTF16(
+ l10n_util::GetString(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_MIXED_CONTENT_WARNING)));
} else if (ssl.has_unsafe_content()) {
state = false;
description.assign(
- l10n_util::GetStringFUTF16(
+ l10n_util::GetStringF(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
connection_msg,
- l10n_util::GetStringUTF16(
+ l10n_util::GetString(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_BAD_HTTPS_WARNING)));
}
}
sections_.push_back(SectionInfo(
state,
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
head_line,
description));
@@ -198,20 +199,16 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle,
if (!visited_before_today) {
sections_.push_back(SectionInfo(
false,
- l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
- string16(),
- l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY)));
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
+ std::wstring(),
+ l10n_util::GetString(IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY)));
} else {
sections_.push_back(SectionInfo(
true,
- 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)))));
+ 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))));
}
observer_->ModelChanged();
}
diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h
index 526372e..17c80b2 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 string16& title,
- const string16& head_line,
- const string16& description)
+ const std::wstring& title,
+ const std::wstring& head_line,
+ const std::wstring& description)
: state(state),
title(title),
head_line(head_line),
@@ -50,13 +50,13 @@ class PageInfoModel {
// unverified identity over HTTPS).
// The title of the section.
- string16 title;
+ std::wstring title;
// A single line describing the section, optional.
- string16 head_line;
+ std::wstring head_line;
// The full description of what this section is.
- string16 description;
+ std::wstring description;
};
PageInfoModel(Profile* profile,
diff --git a/chrome/browser/page_info_window.cc b/chrome/browser/page_info_window.cc
new file mode 100644
index 0000000..c18ef06
--- /dev/null
+++ b/chrome/browser/page_info_window.cc
@@ -0,0 +1,63 @@
+// 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 737c884..c39bd38 100644
--- a/chrome/browser/page_info_window.h
+++ b/chrome/browser/page_info_window.h
@@ -1,28 +1,80 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
-#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;
-namespace browser {
+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);
-// 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);
+ // The id of the server cert for this page (0 means no cert).
+ int cert_id_;
-} // namespace browser
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PageInfoWindow);
+};
-#endif // CHROME_BROWSER_PAGE_INFO_WINDOW_H_
+#endif // #define CHROME_BROWSER_PAGE_INFO_WINDOW_H__
diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h
index c2b13f3..8806976 100644
--- a/chrome/browser/views/browser_dialogs.h
+++ b/chrome/browser/views/browser_dialogs.h
@@ -6,6 +6,7 @@
#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
@@ -97,6 +98,16 @@ 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/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index d4fc97e..1de6e48 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -30,7 +30,6 @@
#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 df95004..4e3b020 100644
--- a/chrome/browser/views/page_info_window_view.cc
+++ b/chrome/browser/views/page_info_window_view.cc
@@ -15,7 +15,6 @@
#include "base/compiler_specific.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"
@@ -75,8 +74,8 @@ class PageInfoWindowView : public views::View,
// views::DialogDelegate methods:
virtual int GetDialogButtons() const;
- virtual string16 GetWindowTitle() const;
- virtual string16 GetWindowName() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetWindowName() const;
virtual views::View* GetContentsView();
virtual views::View* GetExtraView();
virtual bool CanResize() const { return true; }
@@ -110,10 +109,10 @@ class PageInfoWindowView : public views::View,
// optional head-line (in bold) and a description.
class Section : public views::View {
public:
- Section(const string16& title,
+ Section(const std::wstring& title,
bool state,
- const string16& head_line,
- const string16& description);
+ const std::wstring& head_line,
+ const std::wstring& description);
virtual ~Section();
virtual int GetHeightForWidth(int w);
@@ -121,16 +120,16 @@ class Section : public views::View {
private:
// The text placed on top of the section (on the left of the separator bar).
- string16 title_;
+ std::wstring title_;
// Whether to show the good/bad icon.
bool state_;
// The first line of the description, show in bold.
- string16 head_line_;
+ std::wstring head_line_;
// The description, displayed below the head line.
- string16 description_;
+ std::wstring description_;
static SkBitmap* good_state_icon_;
static SkBitmap* bad_state_icon_;
@@ -238,11 +237,11 @@ int PageInfoWindowView::GetDialogButtons() const {
return MessageBoxFlags::DIALOGBUTTON_CANCEL;
}
-string16 PageInfoWindowView::GetWindowTitle() const {
+std::wstring PageInfoWindowView::GetWindowTitle() const {
return l10n_util::GetString(IDS_PAGEINFO_WINDOW_TITLE);
}
-string16 PageInfoWindowView::GetWindowName() const {
+std::wstring PageInfoWindowView::GetWindowName() const {
return prefs::kPageInfoWindowPlacement;
}
@@ -362,10 +361,10 @@ void PageInfoWindowView::ShowCertDialog(int cert_id) {
////////////////////////////////////////////////////////////////////////////////
// Section
-Section::Section(const string16& title,
+Section::Section(const std::wstring& title,
bool state,
- const string16& head_line,
- const string16& description)
+ const std::wstring& head_line,
+ const std::wstring& description)
: title_(title),
state_(state),
head_line_(head_line),
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 0a25b76..930c848 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1140,7 +1140,6 @@
'browser/gtk/options/passwords_page_gtk.h',
'browser/gtk/options/url_picker_dialog_gtk.cc',
'browser/gtk/options/url_picker_dialog_gtk.h',
- 'browser/gtk/page_info_window_gtk.cc',
'browser/gtk/sad_tab_gtk.cc',
'browser/gtk/sad_tab_gtk.h',
'browser/gtk/slide_animator_gtk.cc',