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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "storage/browser/quota/quota_manager.h" | 14 #include "storage/browser/quota/quota_manager.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class BrowserContext; | 18 class BrowserContext; |
19 } | 19 } |
20 | 20 |
21 class SiteEngagementScoreProvider; | 21 class SiteEngagementScoreProvider; |
22 | 22 |
23 class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy { | 23 class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy { |
24 public: | 24 public: |
| 25 static bool IsEnabled(); |
| 26 |
25 SiteEngagementEvictionPolicy(storage::StorageType type, | 27 SiteEngagementEvictionPolicy(storage::StorageType type, |
26 storage::QuotaManager* manager, | 28 storage::QuotaManager* manager, |
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 storage::GetOriginCallback& callback) override; | 36 const storage::GetOriginCallback& callback) override; |
(...skipping 30 matching lines...) Expand all Loading... |
65 int remaining_tasks_; | 67 int remaining_tasks_; |
66 | 68 |
67 storage::GetOriginCallback eviction_origin_callback_; | 69 storage::GetOriginCallback eviction_origin_callback_; |
68 | 70 |
69 base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_; | 71 base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_; |
70 | 72 |
71 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy); | 73 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy); |
72 }; | 74 }; |
73 | 75 |
74 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | 76 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ |
OLD | NEW |