diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 12:28:15 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 12:28:15 +0000 |
commit | 01a0026b14dc7943c2000bcc5a21225a69ed519f (patch) | |
tree | d954a54ce816f1e810333b221dbd1838f46eb302 /chrome/browser | |
parent | f6aa4702974b6cee20bb9ce5a5da19e370e051d2 (diff) | |
download | chromium_src-01a0026b14dc7943c2000bcc5a21225a69ed519f.zip chromium_src-01a0026b14dc7943c2000bcc5a21225a69ed519f.tar.gz chromium_src-01a0026b14dc7943c2000bcc5a21225a69ed519f.tar.bz2 |
gtk: Add SabTab interface and break the dependency on gtk from SadTabHelper.
BUG=125846
TEST=navigate to chrome://crash or open the Task Manager and end some process.
Both should work fine as before, no regressions
R=erg@chromium.org
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/11316273
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/gtk/sad_tab_gtk.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/sad_tab_gtk.h | 18 | ||||
-rw-r--r-- | chrome/browser/ui/sad_tab.h | 33 | ||||
-rw-r--r-- | chrome/browser/ui/sad_tab_helper.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/sad_tab_helper.h | 11 |
5 files changed, 58 insertions, 20 deletions
diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.cc b/chrome/browser/ui/gtk/sad_tab_gtk.cc index 93f496c..37a25d7 100644 --- a/chrome/browser/ui/gtk/sad_tab_gtk.cc +++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc @@ -179,3 +179,11 @@ void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) { web_contents_->OpenURL(params); } } + +namespace chrome { + +SadTab* SadTab::Create(content::WebContents* web_contents, SadTabKind kind) { + return new SadTabGtk(web_contents, kind); +} + +} // namespace chrome diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.h b/chrome/browser/ui/gtk/sad_tab_gtk.h index a603588..0f1e7eb 100644 --- a/chrome/browser/ui/gtk/sad_tab_gtk.h +++ b/chrome/browser/ui/gtk/sad_tab_gtk.h @@ -6,25 +6,23 @@ #define CHROME_BROWSER_UI_GTK_SAD_TAB_GTK_H_ #include "base/basictypes.h" -#include "chrome/browser/ui/sad_tab_types.h" +#include "base/compiler_specific.h" +#include "chrome/browser/ui/sad_tab.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" typedef struct _GtkWidget GtkWidget; -namespace content { -class WebContents; -} - -class SadTabGtk { +class SadTabGtk : public chrome::SadTab { public: SadTabGtk(content::WebContents* web_contents, chrome::SadTabKind kind); - ~SadTabGtk(); - - void Show(); - void Close(); + virtual ~SadTabGtk(); private: + // Overridden from SadTab: + virtual void Show() OVERRIDE; + virtual void Close() OVERRIDE; + CHROMEGTK_CALLBACK_0(SadTabGtk, void, OnLinkButtonClick); void OnLinkButtonClick(); diff --git a/chrome/browser/ui/sad_tab.h b/chrome/browser/ui/sad_tab.h new file mode 100644 index 0000000..b96c3e4 --- /dev/null +++ b/chrome/browser/ui/sad_tab.h @@ -0,0 +1,33 @@ +// Copyright 2012 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_UI_SAD_TAB_H_ +#define CHROME_BROWSER_UI_SAD_TAB_H_ + +#include "chrome/browser/ui/sad_tab_types.h" + +namespace content { +class WebContents; +} + +namespace chrome { + +// Cross-platform interface to show the Sad tab UI. +class SadTab { + public: + // Factory function to create the platform specific implementations. + static SadTab* Create(content::WebContents* web_contents, SadTabKind kind); + + virtual ~SadTab() {} + + // Shows the Sad tab. + virtual void Show() = 0; + + // Closes the Sad tab. + virtual void Close() = 0; +}; + +} // namespace chrome + +#endif // CHROME_BROWSER_UI_SAD_TAB_H_ diff --git a/chrome/browser/ui/sad_tab_helper.cc b/chrome/browser/ui/sad_tab_helper.cc index 8c8c132..9dfc223 100644 --- a/chrome/browser/ui/sad_tab_helper.cc +++ b/chrome/browser/ui/sad_tab_helper.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "chrome/browser/browser_shutdown.h" -#include "chrome/browser/ui/sad_tab_types.h" +#include "chrome/browser/ui/sad_tab.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h" @@ -17,10 +17,6 @@ #elif defined(TOOLKIT_VIEWS) #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" #endif DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper) @@ -118,7 +114,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(), kind)); + sad_tab_.reset(chrome::SadTab::Create(web_contents(), kind)); sad_tab_->Show(); #else #error Unknown platform diff --git a/chrome/browser/ui/sad_tab_helper.h b/chrome/browser/ui/sad_tab_helper.h index ef56d7d..60d2249 100644 --- a/chrome/browser/ui/sad_tab_helper.h +++ b/chrome/browser/ui/sad_tab_helper.h @@ -17,14 +17,16 @@ #include "base/mac/foundation_util.h" #endif +namespace chrome { +class SadTab; +} + #if defined(OS_MACOSX) class SadTabController; #elif defined(TOOLKIT_VIEWS) namespace views { class Widget; } -#elif defined(TOOLKIT_GTK) -class SadTabGtk; #endif // Per-tab class to manage sad tab views. @@ -42,9 +44,10 @@ class SadTabHelper : public content::WebContentsObserver, #endif private: - explicit SadTabHelper(content::WebContents* web_contents); friend class content::WebContentsUserData<SadTabHelper>; + explicit SadTabHelper(content::WebContents* web_contents); + // Platform specific function to get an instance of the sad tab page. void InstallSadTab(base::TerminationStatus status); @@ -71,7 +74,7 @@ class SadTabHelper : public content::WebContentsObserver, #elif defined(TOOLKIT_VIEWS) scoped_ptr<views::Widget> sad_tab_; #elif defined(TOOLKIT_GTK) - scoped_ptr<SadTabGtk> sad_tab_; + scoped_ptr<chrome::SadTab> sad_tab_; #endif DISALLOW_COPY_AND_ASSIGN(SadTabHelper); |