summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/sad_tab_gtk.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 18:45:56 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 18:45:56 +0000
commit7b9627d188d04b224f972fae709e7cb4f61ae504 (patch)
tree4d37368f881c9dae023e5172013e87f0b7c58676 /chrome/browser/gtk/sad_tab_gtk.h
parent72baf67602ab1dbf95c34a5d8301e0ac5f8b8b41 (diff)
downloadchromium_src-7b9627d188d04b224f972fae709e7cb4f61ae504.zip
chromium_src-7b9627d188d04b224f972fae709e7cb4f61ae504.tar.gz
chromium_src-7b9627d188d04b224f972fae709e7cb4f61ae504.tar.bz2
Render a "sad tab" on tab crash.
Uses the NotificationRegistrar to notice TAB_CONTENTS_[DIS]CONNECTED events. When it disconnects, add a SadTabGtk to the TabContentsView. Delete it when the tab contents reconnects. BUG=http://www.crbug.com/11081 TEST=Open http://about:crash. Verify that the sad tab renders properly. Navigate to another page to make sure the SadTabGtk is correctly replaced with a new RenderWidgetHostViewGtk. Review URL: http://codereview.chromium.org/111003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/sad_tab_gtk.h')
-rw-r--r--chrome/browser/gtk/sad_tab_gtk.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/browser/gtk/sad_tab_gtk.h b/chrome/browser/gtk/sad_tab_gtk.h
new file mode 100644
index 0000000..aed2454
--- /dev/null
+++ b/chrome/browser/gtk/sad_tab_gtk.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_GTK_SAD_TAB_GTK_H_
+#define CHROME_BROWSER_GTK_SAD_TAB_GTK_H_
+
+#include <gtk/gtk.h>
+
+#include "base/basictypes.h"
+#include "base/gfx/rect.h"
+#include "chrome/common/owned_widget_gtk.h"
+
+class SadTabGtk {
+ public:
+ SadTabGtk();
+ ~SadTabGtk();
+
+ GtkWidget* widget() { return widget_.get(); }
+
+ private:
+ // expose-event handler that redraws the SadTabGtk.
+ static gboolean OnExposeThunk(GtkWidget* widget,
+ GdkEventExpose* event,
+ const SadTabGtk* sad_tab);
+
+ gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event) const;
+
+ // configure-event handler that gets the new bounds of the SadTabGtk.
+ static gboolean OnConfigureThunk(GtkWidget* widget,
+ GdkEventConfigure* event,
+ SadTabGtk* sad_tab);
+
+ gboolean OnConfigure(GtkWidget* widget, GdkEventConfigure* event);
+
+ // Track the view's width and height from configure-event signals.
+ int width_;
+ int height_;
+
+ // Regions within the display for different components, set on a
+ // configure-event. These are relative to the bounds of the widget.
+ gfx::Rect icon_bounds_;
+ int title_y_;
+ int message_y_;
+
+ OwnedWidgetGtk widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(SadTabGtk);
+};
+
+#endif // CHROME_BROWSER_GTK_SAD_TAB_GTK_H__