| Index: chrome/browser/engagement/site_engagement_eviction_policy.h
|
| diff --git a/chrome/browser/engagement/site_engagement_eviction_policy.h b/chrome/browser/engagement/site_engagement_eviction_policy.h
|
| index 470b0ec33d2e617ca8527dedc75540081b74f7e0..3ea3fdebfe95f0a14cce771b3f0c70ce30c09126 100644
|
| --- a/chrome/browser/engagement/site_engagement_eviction_policy.h
|
| +++ b/chrome/browser/engagement/site_engagement_eviction_policy.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "storage/browser/quota/quota_manager.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -21,28 +22,48 @@ class SiteEngagementScoreProvider;
|
|
|
| class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy {
|
| public:
|
| - explicit SiteEngagementEvictionPolicy(
|
| - content::BrowserContext* browser_context);
|
| - virtual ~SiteEngagementEvictionPolicy();
|
| + SiteEngagementEvictionPolicy(storage::StorageType type,
|
| + storage::QuotaManager* manager,
|
| + content::BrowserContext* browser_context);
|
| + ~SiteEngagementEvictionPolicy() override;
|
|
|
| // Overridden from storage::QuotaEvictionPolicy:
|
| void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>&
|
| special_storage_policy,
|
| - const std::map<GURL, int64>& usage_map,
|
| - int64 global_quota,
|
| const storage::GetOriginCallback& callback) override;
|
|
|
| private:
|
| friend class SiteEngagementEvictionPolicyTest;
|
| + friend class SiteEngagementEvictionPolicyWithQuotaManagerTest;
|
|
|
| - static GURL CalculateEvictionOrigin(
|
| + static void SetSiteEngagementScoreProviderCallbackForTests(
|
| + base::Callback<SiteEngagementScoreProvider*(content::BrowserContext*)>*
|
| + callback);
|
| +
|
| + static GURL CalculateEvictionOriginForTests(
|
| const scoped_refptr<storage::SpecialStoragePolicy>&
|
| special_storage_policy,
|
| SiteEngagementScoreProvider* score_provider,
|
| const std::map<GURL, int64>& usage_map,
|
| int64 global_quota);
|
|
|
| - content::BrowserContext* browser_context_;
|
| + void DidGetGlobalUsage(storage::StorageType type, int64, int64);
|
| + void DidGetGlobalQuota(storage::QuotaStatusCode status, int64 quota);
|
| + void OnQuotaTasksCompleted();
|
| +
|
| + const storage::StorageType type_;
|
| + storage::QuotaManager* const manager_;
|
| + content::BrowserContext* const browser_context_;
|
| +
|
| + scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
|
| + std::map<GURL, int64> usage_map_;
|
| + int64 global_quota_;
|
| +
|
| + int remaining_tasks_;
|
| +
|
| + storage::GetOriginCallback eviction_origin_callback_;
|
| +
|
| + base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy);
|
| };
|
|
|