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

Unified Diff: storage/browser/quota/quota_manager.cc

Issue 2777183010: [Quota] Lower quota for ephemeral mode (ie. session only) (Closed)
Patch Set: comments Created 3 years, 8 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 | « content/browser/quota/quota_manager_unittest.cc ('k') | storage/browser/quota/quota_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/quota/quota_manager.cc
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc
index b9452e44db79f362a9e87023c10f0dfc0006a93e..7b69183818c830ea7523f0c94118354e1b70e0f2 100644
--- a/storage/browser/quota/quota_manager.cc
+++ b/storage/browser/quota/quota_manager.cc
@@ -215,6 +215,7 @@ class QuotaManager::UsageAndQuotaHelper : public QuotaTask {
const GURL& origin,
StorageType type,
bool is_unlimited,
+ bool is_session_only,
bool is_incognito,
const UsageAndQuotaCallback& callback)
: QuotaTask(manager),
@@ -222,6 +223,7 @@ class QuotaManager::UsageAndQuotaHelper : public QuotaTask {
callback_(callback),
type_(type),
is_unlimited_(is_unlimited),
+ is_session_only_(is_session_only),
is_incognito_(is_incognito),
weak_factory_(this) {}
@@ -300,8 +302,10 @@ class QuotaManager::UsageAndQuotaHelper : public QuotaTask {
settings_ = settings;
barrier_closure.Run();
if (type_ == kStorageTypeTemporary && !is_unlimited_) {
- SetDesiredHostQuota(barrier_closure, kQuotaStatusOk,
- settings.per_host_quota);
+ int64_t host_quota = is_session_only_
+ ? settings.session_only_per_host_quota
+ : settings.per_host_quota;
+ SetDesiredHostQuota(barrier_closure, kQuotaStatusOk, host_quota);
}
}
@@ -331,6 +335,7 @@ class QuotaManager::UsageAndQuotaHelper : public QuotaTask {
QuotaManager::UsageAndQuotaCallback callback_;
StorageType type_;
bool is_unlimited_;
+ bool is_session_only_;
bool is_incognito_;
int64_t available_space_ = 0;
int64_t total_space_ = 0;
@@ -841,9 +846,12 @@ void QuotaManager::GetUsageAndQuotaForWebApps(
return;
}
LazyInitialize();
+
+ bool is_session_only = special_storage_policy_ &&
+ special_storage_policy_->IsStorageSessionOnly(origin);
UsageAndQuotaHelper* helper = new UsageAndQuotaHelper(
- this, origin, type, IsStorageUnlimited(origin, type), is_incognito_,
- callback);
+ this, origin, type, IsStorageUnlimited(origin, type), is_session_only,
+ is_incognito_, callback);
helper->Start();
}
« no previous file with comments | « content/browser/quota/quota_manager_unittest.cc ('k') | storage/browser/quota/quota_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698