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

Unified Diff: chrome/browser/apps/ephemeral_app_service.cc

Issue 298253002: cleanup: Remove NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED from c/b/apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
Index: chrome/browser/apps/ephemeral_app_service.cc
diff --git a/chrome/browser/apps/ephemeral_app_service.cc b/chrome/browser/apps/ephemeral_app_service.cc
index 0e4e117550a3f38f0eabf67d3cc3f0e9d8304510..ac76f50e21f9bebd03a3d2475de1c18ce61a101e 100644
--- a/chrome/browser/apps/ephemeral_app_service.cc
+++ b/chrome/browser/apps/ephemeral_app_service.cc
@@ -62,16 +62,14 @@ EphemeralAppService* EphemeralAppService::Get(Profile* profile) {
EphemeralAppService::EphemeralAppService(Profile* profile)
: profile_(profile),
+ extension_registry_observer_(this),
ephemeral_app_count_(-1) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableEphemeralApps))
return;
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
- content::Source<Profile>(profile_));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
- content::Source<Profile>(profile_));
+ extension_registry_observer_.Add(
+ extensions::ExtensionRegistry::Get(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
@@ -90,26 +88,6 @@ void EphemeralAppService::Observe(
Init();
break;
}
- case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: {
- const Extension* extension =
- content::Details<const InstalledExtensionInfo>(details)->extension;
- DCHECK(extension);
- if (extensions::util::IsEphemeralApp(extension->id(), profile_)) {
- ++ephemeral_app_count_;
- if (ephemeral_app_count_ >= kGarbageCollectAppsTriggerCount)
- TriggerGarbageCollect(
- base::TimeDelta::FromSeconds(kGarbageCollectAppsInstallDelay));
- }
- break;
- }
- case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
- const Extension* extension =
- content::Details<const Extension>(details).ptr();
- DCHECK(extension);
- if (extensions::util::IsEphemeralApp(extension->id(), profile_))
- --ephemeral_app_count_;
- break;
- }
case chrome::NOTIFICATION_PROFILE_DESTROYED: {
// Ideally we need to know when the extension system is shutting down.
garbage_collect_apps_timer_.Stop();
@@ -120,6 +98,28 @@ void EphemeralAppService::Observe(
}
}
+void EphemeralAppService::OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ bool is_update,
+ const std::string& old_name) {
+ DCHECK(extension);
not at google - send to devlin 2014/05/27 17:40:16 no need for DCHECK
limasdf 2014/05/27 17:54:07 Done.
+ if (extensions::util::IsEphemeralApp(extension->id(), profile_)) {
+ ++ephemeral_app_count_;
+ if (ephemeral_app_count_ >= kGarbageCollectAppsTriggerCount)
+ TriggerGarbageCollect(
+ base::TimeDelta::FromSeconds(kGarbageCollectAppsInstallDelay));
+ }
+}
+
+void EphemeralAppService::OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension) {
+ DCHECK(extension);
not at google - send to devlin 2014/05/27 17:40:16 no need for DCHECK
limasdf 2014/05/27 17:54:07 Done.
+ if (extensions::util::IsEphemeralApp(extension->id(), profile_))
+ --ephemeral_app_count_;
+}
+
void EphemeralAppService::Init() {
InitEphemeralAppCount();
TriggerGarbageCollect(

Powered by Google App Engine
This is Rietveld 408576698