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

Unified Diff: chrome/browser/ui/gtk/sad_tab_gtk.cc

Issue 7610011: Update Sad Tab help text and link. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm ('k') | chrome/browser/ui/views/sad_tab_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/sad_tab_gtk.cc
diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.cc b/chrome/browser/ui/gtk/sad_tab_gtk.cc
index d8187296390fe5ff274de1c31b03c8bd24cd3741..884431f0dc4cf39297df94a4352df508295a2bdf 100644
--- a/chrome/browser/ui/gtk/sad_tab_gtk.cc
+++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc
@@ -4,8 +4,7 @@
#include "chrome/browser/ui/gtk/sad_tab_gtk.h"
-#include <string>
-
+#include "base/utf_string_conversions.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
#include "chrome/common/url_constants.h"
@@ -109,15 +108,42 @@ SadTabGtk::SadTabGtk(TabContents* tab_contents, Kind kind)
gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, 0);
if (tab_contents_ != NULL) {
- // Add the learn-more link and center-align it in an alignment.
- GtkWidget* link = gtk_chrome_link_button_new(
- l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str());
+ // Create the help link and alignment.
+ std::string link_text(l10n_util::GetStringUTF8(
+ kind == CRASHED ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE));
+ GtkWidget* link = gtk_chrome_link_button_new(link_text.c_str());
gtk_chrome_link_button_set_normal_color(GTK_CHROME_LINK_BUTTON(link),
&ui::kGdkWhite);
g_signal_connect(link, "clicked", G_CALLBACK(OnLinkButtonClickThunk), this);
- GtkWidget* link_alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
- gtk_container_add(GTK_CONTAINER(link_alignment), link);
- gtk_box_pack_start(GTK_BOX(vbox), link_alignment, FALSE, FALSE, 0);
+ GtkWidget* help_alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
+
+ if (kind == CRASHED) {
+ // Use a horizontal box to contain the help text and link.
+ GtkWidget* help_hbox = gtk_hbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(vbox), help_hbox);
+
+ size_t offset = 0;
+ string16 help_text(l10n_util::GetStringFUTF16(IDS_SAD_TAB_HELP_MESSAGE,
+ string16(), &offset));
+ std::string help_prefix_text(UTF16ToUTF8(help_text.substr(0, offset)));
+ std::string help_suffix_text(UTF16ToUTF8(help_text.substr(offset)));
+
+ GtkWidget* help_prefix = MakeWhiteMarkupLabel(
+ "<span style=\"normal\">%s</span>", help_prefix_text);
+ GtkWidget* help_suffix = MakeWhiteMarkupLabel(
+ "<span style=\"normal\">%s</span>", help_suffix_text);
+
+ // Add the help link and text to the horizontal box.
+ gtk_box_pack_start(GTK_BOX(help_hbox), help_prefix, FALSE, FALSE, 0);
+ GtkWidget* link_alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
+ gtk_container_add(GTK_CONTAINER(link_alignment), link);
+ gtk_box_pack_start(GTK_BOX(help_hbox), link_alignment, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(help_hbox), help_suffix, FALSE, FALSE, 0);
+ } else {
+ // Add just the help link to a centered alignment.
+ gtk_container_add(GTK_CONTAINER(help_alignment), link);
+ }
+ gtk_box_pack_start(GTK_BOX(vbox), help_alignment, FALSE, FALSE, 0);
}
gtk_widget_show_all(event_box_.get());
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm ('k') | chrome/browser/ui/views/sad_tab_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698