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

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: 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..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(
« 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