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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 337323003: Remove the ability to retain local data of evicted ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unused declaration Created 6 years, 6 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: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 6741c62daaf978fcc7b28844eb881888ed73567d..e886f0f2bcabf12344201e948df525511990cfff 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -182,11 +182,6 @@ const char kPrefGeometryCache[] = "geometry_cache";
// A preference that indicates when an extension is last launched.
const char kPrefLastLaunchTime[] = "last_launch_time";
-// A preference that marks an ephemeral app that was evicted from the cache.
-// Their data is retained and garbage collected when inactive for a long period
-// of time.
-const char kPrefEvictedEphemeralApp[] = "evicted_ephemeral_app";
-
// A preference indicating whether the extension is an ephemeral app.
const char kPrefEphemeralApp[] = "ephemeral_app";
@@ -237,11 +232,6 @@ bool IsBlacklistBitSet(const base::DictionaryValue* ext) {
return ext->GetBoolean(kPrefBlacklist, &bool_value) && bool_value;
}
-bool IsEvictedEphemeralApp(const base::DictionaryValue* ext) {
- bool bool_value;
- return ext->GetBoolean(kPrefEvictedEphemeralApp, &bool_value) && bool_value;
-}
-
void LoadExtensionControlledPrefs(ExtensionPrefs* prefs,
ExtensionPrefValueMap* value_map,
const std::string& extension_id,
@@ -1275,13 +1265,7 @@ void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
observer_list_,
OnExtensionStateChanged(extension_id, false));
} else {
- if (IsEphemeralApp(extension_id)) {
- // Keep ephemeral apps around, but mark them as evicted.
- UpdateExtensionPref(extension_id, kPrefEvictedEphemeralApp,
- new base::FundamentalValue(true));
- } else {
- DeleteExtensionPrefs(extension_id);
- }
+ DeleteExtensionPrefs(extension_id);
}
}
@@ -1409,11 +1393,6 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo(
return scoped_ptr<ExtensionInfo>();
}
- if (IsEvictedEphemeralApp(ext)) {
- // Hide evicted ephemeral apps.
- return scoped_ptr<ExtensionInfo>();
- }
-
return GetInstalledInfoHelper(extension_id, ext);
}
@@ -1590,55 +1569,7 @@ scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
return extensions_info.Pass();
}
-scoped_ptr<ExtensionPrefs::ExtensionsInfo>
-ExtensionPrefs::GetEvictedEphemeralAppsInfo() const {
- scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
-
- const base::DictionaryValue* extensions =
- prefs_->GetDictionary(pref_names::kExtensions);
- for (base::DictionaryValue::Iterator extension_id(*extensions);
- !extension_id.IsAtEnd(); extension_id.Advance()) {
- const base::DictionaryValue* ext = NULL;
- if (!Extension::IdIsValid(extension_id.key()) ||
- !extension_id.value().GetAsDictionary(&ext)) {
- continue;
- }
-
- if (!IsEvictedEphemeralApp(ext))
- continue;
-
- scoped_ptr<ExtensionInfo> info =
- GetInstalledInfoHelper(extension_id.key(), ext);
- if (info)
- extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
- }
-
- return extensions_info.Pass();
-}
-
-scoped_ptr<ExtensionInfo> ExtensionPrefs::GetEvictedEphemeralAppInfo(
- const std::string& extension_id) const {
- const base::DictionaryValue* extension_prefs = GetExtensionPref(extension_id);
- if (!extension_prefs)
- return scoped_ptr<ExtensionInfo>();
-
- if (!IsEvictedEphemeralApp(extension_prefs))
- return scoped_ptr<ExtensionInfo>();
-
- return GetInstalledInfoHelper(extension_id, extension_prefs);
-}
-
-void ExtensionPrefs::RemoveEvictedEphemeralApp(
- const std::string& extension_id) {
- if (ReadPrefAsBooleanAndReturn(extension_id, kPrefEvictedEphemeralApp))
- DeleteExtensionPrefs(extension_id);
-}
-
bool ExtensionPrefs::IsEphemeralApp(const std::string& extension_id) const {
- // Hide the data of evicted ephemeral apps.
- if (ReadPrefAsBooleanAndReturn(extension_id, kPrefEvictedEphemeralApp))
- return false;
-
if (ReadPrefAsBooleanAndReturn(extension_id, kPrefEphemeralApp))
return true;
@@ -1650,11 +1581,8 @@ bool ExtensionPrefs::IsEphemeralApp(const std::string& extension_id) const {
void ExtensionPrefs::OnEphemeralAppPromoted(const std::string& extension_id) {
DCHECK(IsEphemeralApp(extension_id));
- ScopedExtensionPrefUpdate update(prefs_, extension_id);
- update->Set(kPrefEphemeralApp, new base::FundamentalValue(false));
-
- DCHECK(!IsEvictedEphemeralApp(update.Get()));
- update->Remove(kPrefEvictedEphemeralApp, NULL);
+ UpdateExtensionPref(
+ extension_id, kPrefEphemeralApp, new base::FundamentalValue(false));
}
bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
@@ -2206,9 +2134,6 @@ void ExtensionPrefs::FinishExtensionInfoPrefs(
// Clear state that may be registered from a previous install.
extension_dict->Remove(EventRouter::kRegisteredEvents, NULL);
- // When evicted ephemeral apps are re-installed, this flag must be reset.
- extension_dict->Remove(kPrefEvictedEphemeralApp, NULL);
-
// FYI, all code below here races on sudden shutdown because |extension_dict|,
// |app_sorting_|, |extension_pref_value_map_|, and (potentially) observers
// are updated non-transactionally. This is probably not fixable without
« chrome/browser/apps/ephemeral_app_service.h ('K') | « extensions/browser/extension_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698