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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 297263003: Optimize promotion of ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 | « extensions/browser/extension_prefs.h ('k') | extensions/browser/extension_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 3bbe6b2492bbde73b34ac4d0faaa4fcc8d5b0439..2ebbadd38b35e6fd07312e48b9373f62a0d5673b 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -1640,6 +1640,10 @@ void ExtensionPrefs::RemoveEvictedEphemeralApp(
}
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;
@@ -1648,6 +1652,16 @@ bool ExtensionPrefs::IsEphemeralApp(const std::string& extension_id) const {
return (GetCreationFlags(extension_id) & Extension::IS_EPHEMERAL) != 0;
}
+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);
+}
+
bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp);
}
@@ -2142,10 +2156,8 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs(
if (blacklisted_for_malware)
extension_dict->Set(kPrefBlacklist, new base::FundamentalValue(true));
- if (is_ephemeral)
- extension_dict->Set(kPrefEphemeralApp, new base::FundamentalValue(true));
- else
- extension_dict->Remove(kPrefEphemeralApp, NULL);
+ extension_dict->Set(kPrefEphemeralApp,
+ new base::FundamentalValue(is_ephemeral));
base::FilePath::StringType path = MakePathRelative(install_directory_,
extension->path());
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | extensions/browser/extension_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698