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

Unified Diff: chrome/browser/apps/ephemeral_app_service.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: 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 c7b4cb2b174067ecea4c0391c952603960db68e1..067de9cc7067b990e3fd5b764774ab13a0f68a0e 100644
--- a/chrome/browser/apps/ephemeral_app_service.cc
+++ b/chrome/browser/apps/ephemeral_app_service.cc
@@ -7,7 +7,6 @@
#include "base/command_line.h"
#include "chrome/browser/apps/ephemeral_app_service_factory.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/data_deleter.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -23,11 +22,9 @@
#include "extensions/common/extension_set.h"
using extensions::Extension;
-using extensions::ExtensionInfo;
using extensions::ExtensionPrefs;
using extensions::ExtensionSet;
using extensions::ExtensionSystem;
-using extensions::InstalledExtensionInfo;
namespace {
@@ -44,16 +41,11 @@ const int kGarbageCollectAppsInstallDelay = 15;
// kMaxEphemeralAppsCount.
const int kGarbageCollectAppsTriggerCount = 35;
-// The number of seconds after startup before performing garbage collection
-// of the data of evicted ephemeral apps.
-const int kGarbageCollectDataStartupDelay = 120;
-
} // namespace
const int EphemeralAppService::kAppInactiveThreshold = 10;
const int EphemeralAppService::kAppKeepThreshold = 1;
const int EphemeralAppService::kMaxEphemeralAppsCount = 30;
-const int EphemeralAppService::kDataInactiveThreshold = 90;
// static
EphemeralAppService* EphemeralAppService::Get(Profile* profile) {
@@ -131,12 +123,6 @@ void EphemeralAppService::Init() {
InitEphemeralAppCount();
TriggerGarbageCollect(
base::TimeDelta::FromSeconds(kGarbageCollectAppsStartupDelay));
-
- garbage_collect_data_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromSeconds(kGarbageCollectDataStartupDelay),
- this,
- &EphemeralAppService::GarbageCollectData);
}
void EphemeralAppService::InitEphemeralAppCount() {
@@ -245,52 +231,3 @@ void EphemeralAppService::GetAppsToRemove(
}
}
}
-
-void EphemeralAppService::GarbageCollectData() {
- ExtensionService* service =
- ExtensionSystem::Get(profile_)->extension_service();
- DCHECK(service);
- ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
- DCHECK(prefs);
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> evicted_apps_info(
- prefs->GetEvictedEphemeralAppsInfo());
-
- base::Time time_now = base::Time::Now();
- const base::Time inactive_threshold =
- time_now - base::TimeDelta::FromDays(kDataInactiveThreshold);
-
- for (size_t i = 0; i < evicted_apps_info->size(); ++i) {
- ExtensionInfo* info = evicted_apps_info->at(i).get();
- base::Time last_launch_time = prefs->GetLastLaunchTime(info->extension_id);
- if (last_launch_time > inactive_threshold)
- continue;
-
- // Sanity check to ensure the app is not currently installed.
- if (service->GetInstalledExtension(info->extension_id)) {
- NOTREACHED();
- continue;
- }
-
- // Ensure the app is not waiting to be installed.
- scoped_ptr<ExtensionInfo> delayed_install(
- prefs->GetDelayedInstallInfo(info->extension_id));
- if (delayed_install.get())
- continue;
-
- if (info->extension_manifest.get()) {
- std::string error;
- scoped_refptr<const Extension> extension(Extension::Create(
- info->extension_path,
- info->extension_location,
- *info->extension_manifest,
- prefs->GetCreationFlags(info->extension_id),
- info->extension_id,
- &error));
-
- if (extension.get())
- extensions::DataDeleter::StartDeleting(profile_, extension.get());
- }
-
- prefs->RemoveEvictedEphemeralApp(info->extension_id);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698