Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2092)

Unified Diff: chrome/browser/ui/sad_tab_helper.cc

Issue 10703110: browser/ui: Unify the enum Kind of SadTab used by SadTabViews and SabTabGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/sad_tab_helper.h ('k') | chrome/browser/ui/sad_tab_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/sad_tab_helper.cc
diff --git a/chrome/browser/ui/sad_tab_helper.cc b/chrome/browser/ui/sad_tab_helper.cc
index 0a44d8c747d3bbecfe003cc2b701951db328ab75..1179412db1b5c271d6ecc955d8f166ef7f3a20cd 100644
--- a/chrome/browser/ui/sad_tab_helper.cc
+++ b/chrome/browser/ui/sad_tab_helper.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/ui/sad_tab_types.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
@@ -17,24 +18,25 @@
#include "chrome/browser/ui/views/sad_tab_view.h"
#include "ui/views/widget/widget.h"
#elif defined(TOOLKIT_GTK)
-
#include <gtk/gtk.h>
#include "chrome/browser/ui/gtk/sad_tab_gtk.h"
#include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.h"
#endif
-using content::WebContents;
-
-SadTabHelper::SadTabHelper(WebContents* web_contents)
+SadTabHelper::SadTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
- content::Source<WebContents>(web_contents));
+ content::Source<content::WebContents>(web_contents));
}
SadTabHelper::~SadTabHelper() {
}
+bool SadTabHelper::HasSadTab() const {
+ return sad_tab_.get() != NULL;
+}
+
void SadTabHelper::RenderViewGone(base::TerminationStatus status) {
// Only show the sad tab if we're not in browser shutdown, so that WebContents
// objects that are not in a browser (e.g., HTML dialogs) and thus are
@@ -85,13 +87,15 @@ void SadTabHelper::Observe(int type,
}
void SadTabHelper::InstallSadTab(base::TerminationStatus status) {
+#if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK)
+ chrome::SadTabKind kind =
+ (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) ?
+ chrome::SAD_TAB_KIND_KILLED : chrome::SAD_TAB_KIND_CRASHED;
+#endif
#if defined(OS_MACOSX)
sad_tab_.reset(
sad_tab_controller_mac::CreateSadTabController(web_contents()));
#elif defined(TOOLKIT_VIEWS)
- SadTabView::Kind kind =
- status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
- SadTabView::KILLED : SadTabView::CRASHED;
views::Widget::InitParams sad_tab_params(
views::Widget::InitParams::TYPE_CONTROL);
// It is not possible to create a native_widget_win that has no parent in
@@ -118,11 +122,7 @@ void SadTabHelper::InstallSadTab(base::TerminationStatus status) {
web_contents()->GetView()->GetContainerBounds(&bounds);
sad_tab_->SetBounds(gfx::Rect(bounds.size()));
#elif defined(TOOLKIT_GTK)
- sad_tab_.reset(new SadTabGtk(
- web_contents(),
- status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED
- ? SadTabGtk::KILLED
- : SadTabGtk::CRASHED));
+ sad_tab_.reset(new SadTabGtk(web_contents(), kind));
GtkWidget* expanded_container =
ChromeWebContentsViewDelegateGtk::GetFor(web_contents())->
expanded_container();
@@ -132,7 +132,3 @@ void SadTabHelper::InstallSadTab(base::TerminationStatus status) {
#error Unknown platform
#endif
}
-
-bool SadTabHelper::HasSadTab() {
- return sad_tab_.get() != NULL;
-}
« no previous file with comments | « chrome/browser/ui/sad_tab_helper.h ('k') | chrome/browser/ui/sad_tab_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698