| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" | 5 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 8 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Allow ourselves to be resized arbitrarily small. | 65 // Allow ourselves to be resized arbitrarily small. |
| 66 gtk_widget_set_size_request(event_box_.get(), 0, 0); | 66 gtk_widget_set_size_request(event_box_.get(), 0, 0); |
| 67 | 67 |
| 68 GtkWidget* centering = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); | 68 GtkWidget* centering = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); |
| 69 gtk_container_add(GTK_CONTAINER(event_box_.get()), centering); | 69 gtk_container_add(GTK_CONTAINER(event_box_.get()), centering); |
| 70 | 70 |
| 71 // Use a vertical box to contain icon, title, message and link. | 71 // Use a vertical box to contain icon, title, message and link. |
| 72 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); | 72 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); |
| 73 gtk_container_add(GTK_CONTAINER(centering), vbox); | 73 gtk_container_add(GTK_CONTAINER(centering), vbox); |
| 74 | 74 |
| 75 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 75 // Add center-aligned image. | 76 // Add center-aligned image. |
| 76 GtkWidget* image = gtk_image_new_from_pixbuf( | 77 GtkWidget* image = gtk_image_new_from_pixbuf(rb.GetNativeImageNamed( |
| 77 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 78 kind == CRASHED ? IDR_SAD_TAB : IDR_KILLED_TAB).ToGdkPixbuf()); |
| 78 kind == CRASHED ? IDR_SAD_TAB : IDR_KILLED_TAB)); | |
| 79 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); | 79 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); |
| 80 gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); | 80 gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); |
| 81 | 81 |
| 82 // Add spacer between image and title. | 82 // Add spacer between image and title. |
| 83 GtkWidget* spacer = gtk_label_new(NULL); | 83 GtkWidget* spacer = gtk_label_new(NULL); |
| 84 gtk_label_set_markup(GTK_LABEL(spacer), "<span size=\"larger\"> </span>"); | 84 gtk_label_set_markup(GTK_LABEL(spacer), "<span size=\"larger\"> </span>"); |
| 85 gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, 0); | 85 gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, 0); |
| 86 | 86 |
| 87 // Add center-aligned title. | 87 // Add center-aligned title. |
| 88 GtkWidget* title = MakeWhiteMarkupLabel( | 88 GtkWidget* title = MakeWhiteMarkupLabel( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) { | 158 void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) { |
| 159 if (web_contents_ != NULL) { | 159 if (web_contents_ != NULL) { |
| 160 GURL help_url( | 160 GURL help_url( |
| 161 kind_ == CRASHED ? chrome::kCrashReasonURL : chrome::kKillReasonURL); | 161 kind_ == CRASHED ? chrome::kCrashReasonURL : chrome::kKillReasonURL); |
| 162 OpenURLParams params( | 162 OpenURLParams params( |
| 163 help_url, content::Referrer(), CURRENT_TAB, | 163 help_url, content::Referrer(), CURRENT_TAB, |
| 164 content::PAGE_TRANSITION_LINK, false); | 164 content::PAGE_TRANSITION_LINK, false); |
| 165 web_contents_->OpenURL(params); | 165 web_contents_->OpenURL(params); |
| 166 } | 166 } |
| 167 } | 167 } |
| OLD | NEW |