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

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

Issue 282103003: Moved IS_EPHEMERAL flag to extension prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up file header 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
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/apps/shortcut_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0832e1408eac55aa97ff88b51f3b6518c17608e1..b8d4989f222871ec3632646b43053799b42bb13a 100644
--- a/chrome/browser/apps/ephemeral_app_service.cc
+++ b/chrome/browser/apps/ephemeral_app_service.cc
@@ -18,6 +18,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
@@ -92,7 +93,7 @@ void EphemeralAppService::Observe(
const Extension* extension =
content::Details<const InstalledExtensionInfo>(details)->extension;
DCHECK(extension);
- if (extension->is_ephemeral()) {
+ if (extensions::util::IsEphemeralApp(extension->id(), profile_)) {
++ephemeral_app_count_;
if (ephemeral_app_count_ >= kGarbageCollectAppsTriggerCount)
TriggerGarbageCollect(
@@ -104,7 +105,7 @@ void EphemeralAppService::Observe(
const Extension* extension =
content::Details<const Extension>(details).ptr();
DCHECK(extension);
- if (extension->is_ephemeral())
+ if (extensions::util::IsEphemeralApp(extension->id(), profile_))
--ephemeral_app_count_;
break;
}
@@ -115,7 +116,7 @@ void EphemeralAppService::Observe(
}
default:
NOTREACHED();
- };
+ }
}
void EphemeralAppService::Init() {
@@ -134,12 +135,14 @@ void EphemeralAppService::InitEphemeralAppCount() {
scoped_ptr<ExtensionSet> extensions =
extensions::ExtensionRegistry::Get(profile_)
->GenerateInstalledExtensionsSet();
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
+ DCHECK(prefs);
ephemeral_app_count_ = 0;
for (ExtensionSet::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
const Extension* extension = *it;
- if (extension->is_ephemeral())
+ if (prefs->IsEphemeralApp(extension->id()))
++ephemeral_app_count_;
}
}
@@ -159,6 +162,7 @@ void EphemeralAppService::GarbageCollectApps() {
extensions::ExtensionRegistry::Get(profile_)
->GenerateInstalledExtensionsSet();
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
+ DCHECK(prefs);
int app_count = 0;
LaunchTimeAppMap app_launch_times;
@@ -168,7 +172,7 @@ void EphemeralAppService::GarbageCollectApps() {
for (ExtensionSet::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
const Extension* extension = *it;
- if (!extension->is_ephemeral())
+ if (!prefs->IsEphemeralApp(extension->id()))
continue;
++app_count;
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/apps/shortcut_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698