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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 164151: Fix "crashed extension" infobar browser crashes.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: sync with trunk Created 11 years, 4 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/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index e43df14c8f52ee2296ba41c25c69454294a46934..304a3998db1da7f64601ad8ae18fdf2d1ac69a0c 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"
@@ -18,9 +17,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"
@@ -31,57 +27,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;
@@ -165,21 +113,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())
@@ -189,17 +122,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));
}
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698