OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_dialogs.h" | 5 #include "chrome/browser/ui/browser_dialogs.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/gtk/gtk_util.h" | 13 #include "chrome/browser/ui/gtk/gtk_util.h" |
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
15 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
16 #include "content/browser/renderer_host/render_process_host.h" | 16 #include "content/browser/renderer_host/render_process_host.h" |
17 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/common/result_codes.h" | 19 #include "content/common/result_codes.h" |
20 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
23 #include "ui/base/gtk/gtk_hig_constants.h" | |
24 #include "ui/base/gtk/gtk_signal.h" | 23 #include "ui/base/gtk/gtk_signal.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
28 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
32 // A wrapper class that represents the Gtk dialog. | 31 // A wrapper class that represents the Gtk dialog. |
33 class HungRendererDialogGtk { | 32 class HungRendererDialogGtk { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // ||·----·|| The folowing page(s).. ||| | 93 // ||·----·|| The folowing page(s).. ||| |
95 // || || ||| | 94 // || || ||| |
96 // || ||------------------------||| | 95 // || ||------------------------||| |
97 // || || table of tabs ||| | 96 // || || table of tabs ||| |
98 // || |·------------------------·|| | 97 // || |·------------------------·|| |
99 // |·---------------------------------·| | 98 // |·---------------------------------·| |
100 // | | | 99 // | | |
101 // | kill button wait button| | 100 // | kill button wait button| |
102 // ·-----------------------------------· | 101 // ·-----------------------------------· |
103 GtkWidget* content_area = gtk_dialog_get_content_area(dialog_); | 102 GtkWidget* content_area = gtk_dialog_get_content_area(dialog_); |
104 gtk_box_set_spacing(GTK_BOX(content_area), ui::kContentAreaSpacing); | 103 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); |
105 | 104 |
106 GtkWidget* hbox = gtk_hbox_new(FALSE, 12); | 105 GtkWidget* hbox = gtk_hbox_new(FALSE, 12); |
107 gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 0); | 106 gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 0); |
108 | 107 |
109 // Wrap the icon in a vbox so it stays top aligned. | 108 // Wrap the icon in a vbox so it stays top aligned. |
110 GtkWidget* icon_vbox = gtk_vbox_new(FALSE, 0); | 109 GtkWidget* icon_vbox = gtk_vbox_new(FALSE, 0); |
111 gtk_box_pack_start(GTK_BOX(hbox), icon_vbox, FALSE, FALSE, 0); | 110 gtk_box_pack_start(GTK_BOX(hbox), icon_vbox, FALSE, FALSE, 0); |
112 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 111 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
113 GdkPixbuf* icon_pixbuf = rb.GetNativeImageNamed(IDR_FROZEN_TAB_ICON); | 112 GdkPixbuf* icon_pixbuf = rb.GetNativeImageNamed(IDR_FROZEN_TAB_ICON); |
114 GtkWidget* icon = gtk_image_new_from_pixbuf(icon_pixbuf); | 113 GtkWidget* icon = gtk_image_new_from_pixbuf(icon_pixbuf); |
115 gtk_box_pack_start(GTK_BOX(icon_vbox), icon, FALSE, FALSE, 0); | 114 gtk_box_pack_start(GTK_BOX(icon_vbox), icon, FALSE, FALSE, 0); |
116 | 115 |
117 GtkWidget* vbox = gtk_vbox_new(FALSE, ui::kControlSpacing); | 116 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
118 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); | 117 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
119 | 118 |
120 GtkWidget* text = gtk_label_new( | 119 GtkWidget* text = gtk_label_new( |
121 l10n_util::GetStringUTF8(IDS_BROWSER_HANGMONITOR_RENDERER).c_str()); | 120 l10n_util::GetStringUTF8(IDS_BROWSER_HANGMONITOR_RENDERER).c_str()); |
122 gtk_label_set_line_wrap(GTK_LABEL(text), TRUE); | 121 gtk_label_set_line_wrap(GTK_LABEL(text), TRUE); |
123 gtk_box_pack_start(GTK_BOX(vbox), text, FALSE, FALSE, 0); | 122 gtk_box_pack_start(GTK_BOX(vbox), text, FALSE, FALSE, 0); |
124 | 123 |
125 GtkWidget* scroll_list = gtk_scrolled_window_new(NULL, NULL); | 124 GtkWidget* scroll_list = gtk_scrolled_window_new(NULL, NULL); |
126 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_list), | 125 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_list), |
127 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 126 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 g_instance->ShowForTabContents(contents); | 224 g_instance->ShowForTabContents(contents); |
226 } | 225 } |
227 } | 226 } |
228 | 227 |
229 void HideHungRendererDialog(TabContents* contents) { | 228 void HideHungRendererDialog(TabContents* contents) { |
230 if (!logging::DialogsAreSuppressed() && g_instance) | 229 if (!logging::DialogsAreSuppressed() && g_instance) |
231 g_instance->EndForTabContents(contents); | 230 g_instance->EndForTabContents(contents); |
232 } | 231 } |
233 | 232 |
234 } // namespace browser | 233 } // namespace browser |
OLD | NEW |