summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 00:00:10 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 00:00:10 +0000
commitad0c2e1b9d23279fabdad09f2ca00397dc197b4d (patch)
tree3cdbb1a190e051abb477da077e75a68a7d46f81c /chrome/browser
parent03b3bbf29d5d6eb23984206379e9b9e8f89f16df (diff)
downloadchromium_src-ad0c2e1b9d23279fabdad09f2ca00397dc197b4d.zip
chromium_src-ad0c2e1b9d23279fabdad09f2ca00397dc197b4d.tar.gz
chromium_src-ad0c2e1b9d23279fabdad09f2ca00397dc197b4d.tar.bz2
If an extension crashes or is killed by the task manager then reloaded, the info bar telling the user that the extension has crashed should disappear in ALL windows should the user choose to hit the 'reload' button.
NOTE: If the user 'x's out the info bar, the bars in the other windows will remain. BUG=33396 TEST=none Review URL: http://codereview.chromium.org/548206 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.cc23
-rw-r--r--chrome/browser/extensions/crashed_extension_infobar.h7
-rw-r--r--chrome/browser/tab_contents/infobar_delegate.h7
3 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 7ebead2..c9fe4d0 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -153,6 +153,8 @@ Browser::Browser(Type type, Profile* profile)
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED,
NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::EXTENSION_LOADED,
+ NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED,
@@ -2401,6 +2403,27 @@ void Browser::Observe(NotificationType type,
break;
}
+ case NotificationType::EXTENSION_LOADED: {
+ // If any "This extension has crashed" InfoBarDelegates are around for
+ // this extension, it means that it has been reloaded in another window
+ // so just remove the remaining CrashedExtensionInfoBarDelegate objects.
+ TabContents* tab_contents = GetSelectedTabContents();
+ if (!tab_contents)
+ break;
+ Extension* extension = Details<Extension>(details).ptr();
+ int delegate_count = tab_contents->infobar_delegate_count();
+ CrashedExtensionInfoBarDelegate* delegate = NULL;
+ for (int i = 0; i < delegate_count; ++i) {
+ delegate = tab_contents->GetInfoBarDelegateAt(i)->
+ AsCrashedExtensionInfoBarDelegate();
+ if (!delegate)
+ continue;
+ if (extension->id() == delegate->extension_id())
+ tab_contents->RemoveInfoBar(delegate);
+ }
+ break;
+ }
+
case NotificationType::BROWSER_THEME_CHANGED:
window()->UserChangedTheme();
break;
diff --git a/chrome/browser/extensions/crashed_extension_infobar.h b/chrome/browser/extensions/crashed_extension_infobar.h
index 4a4e625..48e9acb 100644
--- a/chrome/browser/extensions/crashed_extension_infobar.h
+++ b/chrome/browser/extensions/crashed_extension_infobar.h
@@ -25,6 +25,13 @@ class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate {
ExtensionsService* extensions_service,
const Extension* extension);
+ const std::string extension_id() { return extension_id_; }
+
+ // InfoBarDelegate
+ virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate() {
+ return this;
+ }
+
// ConfirmInfoBarDelegate
virtual std::wstring GetMessageText() const;
virtual void InfoBarClosed();
diff --git a/chrome/browser/tab_contents/infobar_delegate.h b/chrome/browser/tab_contents/infobar_delegate.h
index 1ec6506..191a9bb 100644
--- a/chrome/browser/tab_contents/infobar_delegate.h
+++ b/chrome/browser/tab_contents/infobar_delegate.h
@@ -13,6 +13,7 @@
class AlertInfoBarDelegate;
class ConfirmInfoBarDelegate;
+class CrashedExtensionInfoBarDelegate;
class TranslateInfoBarDelegate;
class InfoBar;
class LinkInfoBarDelegate;
@@ -110,6 +111,12 @@ class InfoBarDelegate {
return NULL;
}
+ // Returns a pointer to the CrashedExtensionInfoBarDelegate interface, if
+ // implemented.
+ virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate() {
+ return NULL;
+ }
+
// Returns the type of the infobar. The type determines the appearance (such
// as background color) of the infobar.
virtual Type GetInfoBarType() {