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..aed38893de5eab30f919481e1c97ab1ba2a7672f 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" |
@@ -84,13 +85,12 @@ void ExtensionIndicatorIcon::OnStatusIconClicked() { |
scoped_ptr<base::ListValue> params( |
api::system_indicator::OnClicked::Create()); |
- EventRouter* event_router = EventRouter::Get(profile_); |
scoped_ptr<Event> event(new Event( |
system_indicator::OnClicked::kEventName, |
params.Pass(), |
profile_)); |
- event_router->DispatchEventToExtension( |
- extension_->id(), event.Pass()); |
+ EventRouter::Get(profile_) |
+ ->DispatchEventToExtension(extension_->id(), event.Pass()); |
dewittj
2014/04/28 21:25:49
Don't really need to change this eh?
limasdf
2014/04/28 22:51:40
Yes it doesnt really need to be change. But |event
dewittj
2014/04/28 23:34:52
I know it sounds pedantic, but I'd rather the patc
limasdf
2014/04/29 00:09:29
Yeah. Exactly. Thanks you for letting me know good
|
} |
void ExtensionIndicatorIcon::OnIconUpdated() { |
@@ -121,9 +121,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 +138,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( |