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