This adds a "killed tab" page to be displayed in the case where a tab is killed instead of crashing.
It also adds "about:kill" to simulate kills.
On ChromeOS killed tabs will be reloaded as soon as the user clicks on them unless they are the only tab, or the currently focused tab is killed.
BUG=http://crosbug.com/10043, http://crosbug.com/10711
TEST=Built linux and ChromeOS Chrome and killed a tab, and then did about:crash and made sure that the "Aw, Snap!" page was displayed. Did about:kill and made sure kill page was displayed.
Review URL: http://codereview.chromium.org/6053012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71360 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 4701265..b73ef97 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -2544,7 +2544,7 @@
// objects that are not in a browser (e.g., HTML dialogs) and thus are
// visible do not flash a sad tab page.
if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID)
- view_->OnTabCrashed();
+ view_->OnTabCrashed(status, error_code);
// Hide any visible hung renderer warning for this web contents' process.
hung_renderer_dialog::HideForTabContents(this);
diff --git a/chrome/browser/tab_contents/tab_contents_view.h b/chrome/browser/tab_contents/tab_contents_view.h
index c6b9a618..ac37312 100644
--- a/chrome/browser/tab_contents/tab_contents_view.h
+++ b/chrome/browser/tab_contents/tab_contents_view.h
@@ -80,7 +80,8 @@
// Used to notify the view that a tab has crashed so each platform can
// prepare the sad tab.
- virtual void OnTabCrashed() = 0;
+ virtual void OnTabCrashed(base::TerminationStatus status,
+ int error_code) = 0;
// TODO(brettw) this is a hack. It's used in two places at the time of this
// writing: (1) when render view hosts switch, we need to size the replaced
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index dbd2797..4563251d 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -203,9 +203,13 @@
gdk_window_set_title(content_view->window, WideToUTF8(title).c_str());
}
-void TabContentsViewGtk::OnTabCrashed() {
+void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status,
+ int error_code) {
if (tab_contents() != NULL && !sad_tab_.get()) {
- sad_tab_.reset(new SadTabGtk(tab_contents()));
+ sad_tab_.reset(new SadTabGtk(
+ tab_contents(),
+ status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
+ SadTabGtk::KILLED : SadTabGtk::CRASHED));
InsertIntoContentArea(sad_tab_->widget());
gtk_widget_show(sad_tab_->widget());
}
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h
index 9a016a16..b7f218b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h
@@ -53,7 +53,8 @@
virtual gfx::NativeWindow GetTopLevelNativeWindow() const;
virtual void GetContainerBounds(gfx::Rect* out) const;
virtual void SetPageTitle(const std::wstring& title);
- virtual void OnTabCrashed();
+ virtual void OnTabCrashed(base::TerminationStatus status,
+ int error_code);
virtual void SizeContents(const gfx::Size& size);
virtual void Focus();
virtual void SetInitialFocus();
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h
index 1aab6b84..e1aec6b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.h
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.h
@@ -60,7 +60,8 @@
virtual void GetContainerBounds(gfx::Rect* out) const;
virtual void RenderViewCreated(RenderViewHost* host);
virtual void SetPageTitle(const std::wstring& title);
- virtual void OnTabCrashed();
+ virtual void OnTabCrashed(base::TerminationStatus status,
+ int error_code);
virtual void SizeContents(const gfx::Size& size);
virtual void Focus();
virtual void SetInitialFocus();
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 8d810dd..61cf26bf7 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -175,7 +175,8 @@
// Meaningless on the Mac; widgets don't have a "title" attribute
}
-void TabContentsViewMac::OnTabCrashed() {
+void TabContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */,
+ int /* error_code */) {
if (!sad_tab_.get()) {
TabContents* contents = tab_contents();
DCHECK(contents);