OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <map> | |
11 #include <memory> | |
12 | |
13 #include "base/macros.h" | |
14 #include "base/memory/ref_counted.h" | |
15 #include "storage/browser/quota/quota_manager.h" | |
16 #include "url/gurl.h" | |
17 | |
18 namespace content { | |
19 class BrowserContext; | |
20 } | |
21 | |
22 class SiteEngagementScoreProvider; | |
23 | |
24 class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy { | |
25 public: | |
26 static bool IsEnabled(); | |
27 | |
28 explicit SiteEngagementEvictionPolicy( | |
29 content::BrowserContext* browser_context); | |
30 ~SiteEngagementEvictionPolicy() override; | |
31 | |
32 // Overridden from storage::QuotaEvictionPolicy: | |
33 void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>& | |
34 special_storage_policy, | |
35 const std::set<GURL>& exceptions, | |
36 const std::map<GURL, int64_t>& usage_map, | |
37 int64_t global_quota, | |
38 const storage::GetOriginCallback& callback) override; | |
39 | |
40 private: | |
41 friend class SiteEngagementEvictionPolicyTest; | |
42 | |
43 static GURL CalculateEvictionOriginForTests( | |
44 const scoped_refptr<storage::SpecialStoragePolicy>& | |
45 special_storage_policy, | |
46 SiteEngagementScoreProvider* score_provider, | |
47 const std::set<GURL>& exceptions, | |
48 const std::map<GURL, int64_t>& usage_map, | |
49 int64_t global_quota); | |
50 | |
51 content::BrowserContext* const browser_context_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy); | |
54 }; | |
55 | |
56 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
OLD | NEW |