summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_shelf.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 21:19:57 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 21:19:57 +0000
commita5b04d1c6d10a3a6a1a246342761e55382da711b (patch)
tree9660a03b21f18ad1cb1eedfeaf5b4f053ccb5f87 /chrome/browser/extensions/extension_shelf.cc
parent69a680223700fc62ee97eae634a8f4921ae7c587 (diff)
downloadchromium_src-a5b04d1c6d10a3a6a1a246342761e55382da711b.zip
chromium_src-a5b04d1c6d10a3a6a1a246342761e55382da711b.tar.gz
chromium_src-a5b04d1c6d10a3a6a1a246342761e55382da711b.tar.bz2
TBR: Revert "Hook up more of extension uninstall."
This reverts commit 5b2fc12fbca26b20ed4176ac740c58fe49360c4a. Review URL: http://codereview.chromium.org/113664 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_shelf.cc')
-rw-r--r--chrome/browser/extensions/extension_shelf.cc43
1 files changed, 11 insertions, 32 deletions
diff --git a/chrome/browser/extensions/extension_shelf.cc b/chrome/browser/extensions/extension_shelf.cc
index 445f181e..17623b6 100644
--- a/chrome/browser/extensions/extension_shelf.cc
+++ b/chrome/browser/extensions/extension_shelf.cc
@@ -145,11 +145,11 @@ ExtensionShelf::ExtensionShelf(Browser* browser)
handle_visible_(false),
current_handle_view_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)) {
- // Watch extensions loaded and unloaded notifications.
- registrar_.Add(this, NotificationType::EXTENSIONS_LOADED,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
- NotificationService::AllSources());
+ // Watch extensions loaded notification.
+ NotificationService* ns = NotificationService::current();
+ Source<Profile> ns_source(browser->profile()->GetOriginalProfile());
+ ns->AddObserver(this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
// Add any already-loaded extensions now, since we missed the notification for
// those.
@@ -162,6 +162,12 @@ ExtensionShelf::ExtensionShelf(Browser* browser)
}
}
+ExtensionShelf::~ExtensionShelf() {
+ NotificationService* ns = NotificationService::current();
+ ns->RemoveObserver(this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
+}
+
BrowserBubble* ExtensionShelf::GetHandle() {
if (!handle_.get() && HasExtensionViews() && current_handle_view_) {
ExtensionShelfHandle* handle_view = new ExtensionShelfHandle(this);
@@ -265,11 +271,6 @@ void ExtensionShelf::Observe(NotificationType type,
AddExtensionViews(extensions);
break;
}
- case NotificationType::EXTENSION_UNLOADED: {
- Extension* extension = Details<Extension>(details).ptr();
- RemoveExtensionViews(extension);
- break;
- }
default:
DCHECK(false) << "Unhandled notification of type: " << type.value;
break;
@@ -305,28 +306,6 @@ bool ExtensionShelf::AddExtensionViews(const ExtensionList* extensions) {
return added_toolstrip;
}
-bool ExtensionShelf::RemoveExtensionViews(Extension* extension) {
- if (!HasExtensionViews())
- return false;
-
- bool removed_toolstrip = false;
- int count = GetChildViewCount();
- for (int i = count - 1; i >= 0; --i) {
- ExtensionView* view = static_cast<ExtensionView*>(GetChildViewAt(i));
- if (view->host()->extension()->id() == extension->id()) {
- RemoveChildView(view);
- delete view;
- removed_toolstrip = true;
- }
- }
-
- if (removed_toolstrip) {
- SchedulePaint();
- PreferredSizeChanged();
- }
- return removed_toolstrip;
-}
-
bool ExtensionShelf::HasExtensionViews() {
return GetChildViewCount() > 0;
}