diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 22:39:57 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 22:39:57 +0000 |
commit | 894bb50fe9a1b145221dd6993c159ab9f7a0fc5d (patch) | |
tree | f201aa2984ce40b3ef3fd50f7d211280d1cd33c1 /chrome/browser/browser.cc | |
parent | 182ac532081125b65bc169b56eb8230063a8d3a6 (diff) | |
download | chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.zip chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.tar.gz chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.tar.bz2 |
Hook up more of extension uninstall.
Also removed all external dependencies from ExtensionsService.
It now only sends out notifications, which other services
consume. This should allow us to unit test the
ExtensionsService frontend, but I haven't added that yet.
Review URL: http://codereview.chromium.org/113493
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16676 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 e452b67..3a02939 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -19,6 +19,7 @@ #include "chrome/browser/debugger/debugger_host.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/download/download_manager.h" +#include "chrome/browser/extensions/extension.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/location_bar.h" @@ -188,6 +189,10 @@ Browser::Browser(Type type, Profile* profile) this, NotificationType::SSL_VISIBLE_STATE_CHANGED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, + NotificationType::EXTENSION_UNLOADED, + NotificationService::AllSources()); InitCommandState(); BrowserList::AddBrowser(this); @@ -233,6 +238,10 @@ Browser::~Browser() { this, NotificationType::SSL_VISIBLE_STATE_CHANGED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, + NotificationType::EXTENSION_UNLOADED, + NotificationService::AllSources()); if (profile_->IsOffTheRecord() && !BrowserList::IsOffTheRecordSessionActive()) { @@ -2045,6 +2054,20 @@ void Browser::Observe(NotificationType type, UpdateToolbar(false); break; + case NotificationType::EXTENSION_UNLOADED: { + // Close any tabs from the unloaded extension. + Extension* extension = Details<Extension>(details).ptr(); + for (int i = 0; i < tabstrip_model_.count(); i++) { + TabContents* tc = tabstrip_model_.GetTabContentsAt(i); + if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) && + tc->GetURL().host() == extension->id()) { + CloseTabContents(tc); + return; + } + } + break; + } + default: NOTREACHED() << "Got a notification we didn't register for."; } |