summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_host.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 00:27:14 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 00:27:14 +0000
commitdaba9ebc9d294a645e5569617628a73289755311 (patch)
tree8b7fb3ece5914eb11ad48226039271192c667d62 /chrome/browser/extensions/extension_host.cc
parentca7bf5806cf02793cbd756b7138cd766cc2caf28 (diff)
downloadchromium_src-daba9ebc9d294a645e5569617628a73289755311.zip
chromium_src-daba9ebc9d294a645e5569617628a73289755311.tar.gz
chromium_src-daba9ebc9d294a645e5569617628a73289755311.tar.bz2
Fix "crashed extension" infobar browser crashes.
This is a general rework of how "crashed extension" infobar works and how the extension is actually recovered after the crash. TEST=See bug. http://crbug.com/15888 Review URL: http://codereview.chromium.org/164151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_host.cc')
-rw-r--r--chrome/browser/extensions/extension_host.cc77
1 files changed, 1 insertions, 76 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 898aeaa..010f841 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/extensions/extension_host.h"
-#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
#include "chrome/browser/browser.h"
@@ -17,9 +16,6 @@
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/renderer_host/site_instance.h"
-#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
@@ -29,57 +25,9 @@
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
#include "webkit/glue/context_menu.h"
-namespace {
-
-class CrashedExtensionInfobarDelegate : public ConfirmInfoBarDelegate {
- public:
- CrashedExtensionInfobarDelegate(TabContents* tab_contents,
- ExtensionHost* extension_host)
- : ConfirmInfoBarDelegate(tab_contents),
- extension_host_(extension_host) {
- }
-
- virtual std::wstring GetMessageText() const {
- return l10n_util::GetStringF(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE,
- UTF8ToWide(extension_host_->extension()->name()));
- }
-
- virtual SkBitmap* GetIcon() const {
- // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591
- return ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_INFOBAR_PLUGIN_CRASHED);
- }
-
- virtual int GetButtons() const {
- return BUTTON_OK;
- }
-
- virtual std::wstring GetButtonLabel(
- ConfirmInfoBarDelegate::InfoBarButton button) const {
- if (button == BUTTON_OK)
- return l10n_util::GetString(IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON);
- return ConfirmInfoBarDelegate::GetButtonLabel(button);
- }
-
- virtual bool Accept() {
- extension_host_->RecoverCrashedExtension();
- return true;
- }
-
- private:
- ExtensionHost* extension_host_;
-
- DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfobarDelegate);
-};
-
-} // namespace
-
-
// static
bool ExtensionHost::enable_dom_automation_ = false;
@@ -162,21 +110,6 @@ void ExtensionHost::Observe(NotificationType type,
NavigateToURL(url_);
}
-void ExtensionHost::RecoverCrashedExtension() {
- DCHECK(!IsRenderViewLive());
-#if defined(TOOLKIT_VIEWS)
- if (view_.get()) {
- // The view should call us back to CreateRenderView, which is the place
- // where we create the render process and fire notification.
- view_->RecoverCrashedExtension();
- } else {
- CreateRenderView(NULL);
- }
-#else
- CreateRenderView(NULL);
-#endif
-}
-
void ExtensionHost::UpdatePreferredWidth(int pref_width) {
#if defined(TOOLKIT_VIEWS) || defined(OS_LINUX)
if (view_.get())
@@ -186,17 +119,9 @@ void ExtensionHost::UpdatePreferredWidth(int pref_width) {
void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host) {
DCHECK_EQ(render_view_host_, render_view_host);
- Browser* browser = GetBrowser();
- if (browser) {
- TabContents* current_tab = browser->GetSelectedTabContents();
- if (current_tab) {
- current_tab->AddInfoBar(
- new CrashedExtensionInfobarDelegate(current_tab, this));
- }
- }
NotificationService::current()->Notify(
NotificationType::EXTENSION_PROCESS_CRASHED,
- Source<Profile>(profile_),
+ Source<ExtensionsService>(profile_->GetExtensionsService()),
Details<ExtensionHost>(this));
}