Index: chrome/browser/ui/extensions/extension_installed_bubble.cc |
diff --git a/chrome/browser/ui/extensions/extension_installed_bubble.cc b/chrome/browser/ui/extensions/extension_installed_bubble.cc |
index 7c281addec644fbefc59cdff44e291e00d665445..db32b6a81d13b9d5c0c17ce8f967c7799152b1a4 100644 |
--- a/chrome/browser/ui/extensions/extension_installed_bubble.cc |
+++ b/chrome/browser/ui/extensions/extension_installed_bubble.cc |
@@ -19,6 +19,8 @@ |
#include "chrome/browser/extensions/api/commands/command_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_list.h" |
+#include "chrome/browser/ui/browser_list_observer.h" |
#include "chrome/browser/ui/sync/sync_promo_ui.h" |
#include "chrome/common/extensions/api/extension_action/action_info.h" |
#include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
@@ -43,7 +45,7 @@ const int kAnimationWaitRetries = 10; |
// Class responsible for showing the bubble after it's installed. Owns itself. |
class ExtensionInstalledBubbleObserver |
- : public content::NotificationObserver, |
+ : public chrome::BrowserListObserver, |
public extensions::ExtensionRegistryObserver { |
public: |
explicit ExtensionInstalledBubbleObserver( |
@@ -56,9 +58,7 @@ class ExtensionInstalledBubbleObserver |
// wait on showing the Bubble until the EXTENSION_LOADED gets fired. |
extension_registry_observer_.Add( |
extensions::ExtensionRegistry::Get(bubble_->browser()->profile())); |
- |
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, |
- content::Source<Browser>(bubble_->browser())); |
+ BrowserList::AddObserver(this); |
} |
void Run() { OnExtensionLoaded(nullptr, bubble_->extension()); } |
@@ -66,15 +66,13 @@ class ExtensionInstalledBubbleObserver |
private: |
~ExtensionInstalledBubbleObserver() override {} |
- // content::NotificationObserver: |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override { |
- DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_CLOSING) |
- << "Received unexpected notification"; |
- // Browser is closing before the bubble was shown. |
- // TODO(hcarmona): Look into logging this with the BubbleManager. |
- delete this; |
+ // chrome::BrowserListObserver: |
+ void OnBrowserCloseStarted(Browser* browser) override { |
+ if (bubble_->browser() == browser) { |
+ // Browser is closing before the bubble was shown. |
+ // TODO(hcarmona): Look into logging this with the BubbleManager. |
+ delete this; |
+ } |
} |
// extensions::ExtensionRegistryObserver: |
@@ -139,8 +137,6 @@ class ExtensionInstalledBubbleObserver |
extensions::ExtensionRegistryObserver> |
extension_registry_observer_; |
- content::NotificationRegistrar registrar_; |
- |
// The number of times to retry showing the bubble if the bubble_->browser() |
// action toolbar is animating. |
int animation_wait_retries_; |