| Index: chrome/browser/extensions/external_install_ui.cc
|
| diff --git a/chrome/browser/extensions/external_install_ui.cc b/chrome/browser/extensions/external_install_ui.cc
|
| index 0888c976cb227e126c5454adc8f7e8d4d3f5e9ac..0b0f4e96e77abd8ba27d85b6eabfb3920909aa42 100644
|
| --- a/chrome/browser/extensions/external_install_ui.cc
|
| +++ b/chrome/browser/extensions/external_install_ui.cc
|
| @@ -14,7 +14,6 @@
|
| #include "base/metrics/histogram.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/app/chrome_command_ids.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/extensions/extension_install_prompt.h"
|
| #include "chrome/browser/extensions/extension_install_ui.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| @@ -29,10 +28,6 @@
|
| #include "chrome/common/extensions/extension.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| #include "chrome/common/extensions/manifest_url_handler.h"
|
| -#include "content/public/browser/notification_details.h"
|
| -#include "content/public/browser/notification_observer.h"
|
| -#include "content/public/browser/notification_registrar.h"
|
| -#include "content/public/browser/notification_source.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| #include "grit/theme_resources.h"
|
| @@ -90,8 +85,9 @@ class ExternalInstallDialogDelegate
|
|
|
| // Only shows a menu item, no bubble. Clicking the menu item shows
|
| // an external install dialog.
|
| -class ExternalInstallMenuAlert : public GlobalError,
|
| - public content::NotificationObserver {
|
| +class ExternalInstallMenuAlert
|
| + : public GlobalError,
|
| + public ExtensionService::DisabledExtensionObserver {
|
| public:
|
| ExternalInstallMenuAlert(ExtensionService* service,
|
| const Extension* extension);
|
| @@ -114,15 +110,13 @@ class ExternalInstallMenuAlert : public GlobalError,
|
| virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
|
| virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
|
|
|
| - // content::NotificationObserver implementation.
|
| - virtual void Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) OVERRIDE;
|
| + // ExtensionService::DisabledExtensionObserver implementation.
|
| + virtual void OnDisabledExtensionRemoved(const Extension* extension,
|
| + bool was_enabled) OVERRIDE;
|
|
|
| protected:
|
| ExtensionService* service_;
|
| const Extension* extension_;
|
| - content::NotificationRegistrar registrar_;
|
| };
|
|
|
| // Shows a menu item and a global error bubble, replacing the install dialog.
|
| @@ -242,13 +236,11 @@ ExternalInstallMenuAlert::ExternalInstallMenuAlert(
|
| const Extension* extension)
|
| : service_(service),
|
| extension_(extension) {
|
| - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
|
| - content::Source<Profile>(service->profile()));
|
| - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
|
| - content::Source<Profile>(service->profile()));
|
| + service_->AddDisabledExtensionObserver(this);
|
| }
|
|
|
| ExternalInstallMenuAlert::~ExternalInstallMenuAlert() {
|
| + service_->RemoveDisabledExtensionObserver(this);
|
| }
|
|
|
| GlobalError::Severity ExternalInstallMenuAlert::GetSeverity() {
|
| @@ -311,27 +303,16 @@ void ExternalInstallMenuAlert::BubbleViewCancelButtonPressed(
|
| NOTREACHED();
|
| }
|
|
|
| -void ExternalInstallMenuAlert::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - const Extension* extension = NULL;
|
| +void ExternalInstallMenuAlert::OnDisabledExtensionRemoved(
|
| + const Extension* extension, bool was_enabled) {
|
| // The error is invalidated if the extension has been reloaded or unloaded.
|
| - if (type == chrome::NOTIFICATION_EXTENSION_LOADED) {
|
| - extension = content::Details<const Extension>(details).ptr();
|
| - } else {
|
| - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type);
|
| - extensions::UnloadedExtensionInfo* info =
|
| - content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
|
| - extension = info->extension;
|
| - }
|
| - if (extension == extension_) {
|
| - GlobalErrorService* error_service =
|
| - GlobalErrorServiceFactory::GetForProfile(service_->profile());
|
| - error_service->RemoveGlobalError(this);
|
| - service_->AcknowledgeExternalExtension(extension_->id());
|
| - delete this;
|
| - }
|
| + if (extension != extension_)
|
| + return;
|
| + GlobalErrorService* error_service =
|
| + GlobalErrorServiceFactory::GetForProfile(service_->profile());
|
| + error_service->RemoveGlobalError(this);
|
| + service_->AcknowledgeExternalExtension(extension_->id());
|
| + delete this;
|
| }
|
|
|
| // ExternalInstallGlobalError -----------------------------------------------
|
|
|