Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3702)

Unified Diff: chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc

Issue 250733008: Remove NOTIFICATION_EXTENSION_UNLOADED from system_indicator API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/system_indicator/system_indicator_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
index 71ddd8f145cc039ac98397a237bd701ac68a82a1..4dc30368ea85c4f07ad9f6fdb5010d551c3c510b 100644
--- a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
+++ b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
@@ -17,6 +17,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "ui/gfx/image/image.h"
@@ -121,9 +122,11 @@ ExtensionIndicatorIcon::ExtensionIndicatorIcon(const Extension* extension,
SystemIndicatorManager::SystemIndicatorManager(Profile* profile,
StatusTray* status_tray)
- : profile_(profile), status_tray_(status_tray) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(profile_->GetOriginalProfile()));
+ : profile_(profile),
+ status_tray_(status_tray),
+ extension_registry_observer_(this) {
+ extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
+
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED,
content::Source<Profile>(profile_->GetOriginalProfile()));
}
@@ -136,25 +139,21 @@ void SystemIndicatorManager::Shutdown() {
DCHECK(thread_checker_.CalledOnValidThread());
}
+void SystemIndicatorManager::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ RemoveIndicator(extension->id());
+}
+
void SystemIndicatorManager::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED);
- switch (type) {
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED:
- RemoveIndicator(
- content::Details<UnloadedExtensionInfo>(details)->extension->id());
- break;
- case chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED:
- OnSystemIndicatorChanged(
- content::Details<ExtensionAction>(details).ptr());
- break;
- default:
- NOTREACHED();
- break;
- }
+ OnSystemIndicatorChanged(content::Details<ExtensionAction>(details).ptr());
}
void SystemIndicatorManager::OnSystemIndicatorChanged(
« no previous file with comments | « chrome/browser/extensions/api/system_indicator/system_indicator_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698