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

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

Issue 10703110: browser/ui: Unify the enum Kind of SadTab used by SadTabViews and SabTabGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/gtk/sad_tab_gtk.h ('k') | chrome/browser/ui/sad_tab_helper.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 f871c51623a82c8f712a12fdd48df4a947a19e50..1849f3bb80ce3ac2bc3c85f4c1c5b5f9334c27cb 100644
--- a/chrome/browser/ui/gtk/sad_tab_gtk.cc
+++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc
@@ -52,7 +52,7 @@ GtkWidget* MakeWhiteMarkupLabel(const char* format, const std::string& str) {
} // namespace
-SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
+SadTabGtk::SadTabGtk(WebContents* web_contents, chrome::SadTabKind kind)
: web_contents_(web_contents),
kind_(kind) {
DCHECK(web_contents_);
@@ -60,9 +60,8 @@ SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
// Use an event box to get the background painting correctly.
event_box_.Own(gtk_event_box_new());
gtk_widget_modify_bg(event_box_.get(), GTK_STATE_NORMAL,
- kind == CRASHED ?
- &kCrashedBackgroundColor :
- &kKilledBackgroundColor);
+ (kind == chrome::SAD_TAB_KIND_CRASHED) ?
+ &kCrashedBackgroundColor : &kKilledBackgroundColor);
// Allow ourselves to be resized arbitrarily small.
gtk_widget_set_size_request(event_box_.get(), 0, 0);
@@ -76,7 +75,8 @@ SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
// Add center-aligned image.
GtkWidget* image = gtk_image_new_from_pixbuf(rb.GetNativeImageNamed(
- kind == CRASHED ? IDR_SAD_TAB : IDR_KILLED_TAB).ToGdkPixbuf());
+ (kind == chrome::SAD_TAB_KIND_CRASHED) ?
+ IDR_SAD_TAB : IDR_KILLED_TAB).ToGdkPixbuf());
gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5);
gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0);
@@ -88,9 +88,8 @@ SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
// Add center-aligned title.
GtkWidget* title = MakeWhiteMarkupLabel(
"<span size=\"larger\" style=\"normal\"><b>%s</b></span>",
- l10n_util::GetStringUTF8(kind == CRASHED ?
- IDS_SAD_TAB_TITLE :
- IDS_KILLED_TAB_TITLE));
+ l10n_util::GetStringUTF8((kind == chrome::SAD_TAB_KIND_CRASHED) ?
+ IDS_SAD_TAB_TITLE : IDS_KILLED_TAB_TITLE));
gtk_box_pack_start(GTK_BOX(vbox), title, FALSE, FALSE, 0);
// Add spacer between title and message.
@@ -100,9 +99,8 @@ SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
// Add center-aligned message.
GtkWidget* message = MakeWhiteMarkupLabel(
"<span style=\"normal\">%s</span>",
- l10n_util::GetStringUTF8(kind == CRASHED ?
- IDS_SAD_TAB_MESSAGE :
- IDS_KILLED_TAB_MESSAGE));
+ l10n_util::GetStringUTF8((kind == chrome::SAD_TAB_KIND_CRASHED) ?
+ IDS_SAD_TAB_MESSAGE : IDS_KILLED_TAB_MESSAGE));
gtk_label_set_line_wrap(GTK_LABEL(message), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), message, FALSE, FALSE, 0);
@@ -110,17 +108,18 @@ SadTabGtk::SadTabGtk(WebContents* web_contents, Kind kind)
spacer = gtk_label_new(" ");
gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, 0);
- if (web_contents_ != NULL) {
+ if (web_contents_) {
// Create the help link and alignment.
std::string link_text(l10n_util::GetStringUTF8(
- kind == CRASHED ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE));
+ (kind == chrome::SAD_TAB_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* help_alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
- if (kind == CRASHED) {
+ if (kind == chrome::SAD_TAB_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);
@@ -157,12 +156,11 @@ SadTabGtk::~SadTabGtk() {
}
void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) {
- if (web_contents_ != NULL) {
- GURL help_url(
- kind_ == CRASHED ? chrome::kCrashReasonURL : chrome::kKillReasonURL);
- OpenURLParams params(
- help_url, content::Referrer(), CURRENT_TAB,
- content::PAGE_TRANSITION_LINK, false);
+ if (web_contents_) {
+ GURL help_url((kind_ == chrome::SAD_TAB_KIND_CRASHED) ?
+ chrome::kCrashReasonURL : chrome::kKillReasonURL);
+ OpenURLParams params(help_url, content::Referrer(), CURRENT_TAB,
+ content::PAGE_TRANSITION_LINK, false);
web_contents_->OpenURL(params);
}
}
« no previous file with comments | « chrome/browser/ui/gtk/sad_tab_gtk.h ('k') | chrome/browser/ui/sad_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698