diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-30 00:00:10 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-30 00:00:10 +0000 |
commit | ad0c2e1b9d23279fabdad09f2ca00397dc197b4d (patch) | |
tree | 3cdbb1a190e051abb477da077e75a68a7d46f81c /chrome/browser/browser.cc | |
parent | 03b3bbf29d5d6eb23984206379e9b9e8f89f16df (diff) | |
download | chromium_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/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 23 |
1 files changed, 23 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; |