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