| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // thread and does not cause any cleanup, decay, etc. | 98 // thread and does not cause any cleanup, decay, etc. |
| 99 // | 99 // |
| 100 // Should only be used if you cannot create a SiteEngagementService (i.e. you | 100 // Should only be used if you cannot create a SiteEngagementService (i.e. you |
| 101 // cannot run on the UI thread). | 101 // cannot run on the UI thread). |
| 102 static double GetScoreFromSettings(HostContentSettingsMap* settings, | 102 static double GetScoreFromSettings(HostContentSettingsMap* settings, |
| 103 const GURL& origin); | 103 const GURL& origin); |
| 104 | 104 |
| 105 explicit SiteEngagementService(Profile* profile); | 105 explicit SiteEngagementService(Profile* profile); |
| 106 ~SiteEngagementService() override; | 106 ~SiteEngagementService() override; |
| 107 | 107 |
| 108 // KeyedService support: |
| 109 void Shutdown() override; |
| 110 |
| 108 // Returns the engagement level of |url|. | 111 // Returns the engagement level of |url|. |
| 109 blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url) const; | 112 blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url) const; |
| 110 | 113 |
| 111 // Returns a map of all stored origins and their engagement scores. | 114 // Returns a map of all stored origins and their engagement scores. |
| 112 std::map<GURL, double> GetScoreMap() const; | 115 std::map<GURL, double> GetScoreMap() const; |
| 113 | 116 |
| 114 // Returns whether the engagement service has enough data to make meaningful | 117 // Returns whether the engagement service has enough data to make meaningful |
| 115 // decisions. Clients should avoid using engagement in their heuristic until | 118 // decisions. Clients should avoid using engagement in their heuristic until |
| 116 // this is true. | 119 // this is true. |
| 117 bool IsBootstrapped() const; | 120 bool IsBootstrapped() const; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // A list of observers. When any origin registers an engagement-increasing | 291 // A list of observers. When any origin registers an engagement-increasing |
| 289 // event, each observer's OnEngagementIncreased method will be called. | 292 // event, each observer's OnEngagementIncreased method will be called. |
| 290 base::ObserverList<SiteEngagementObserver> observer_list_; | 293 base::ObserverList<SiteEngagementObserver> observer_list_; |
| 291 | 294 |
| 292 base::WeakPtrFactory<SiteEngagementService> weak_factory_; | 295 base::WeakPtrFactory<SiteEngagementService> weak_factory_; |
| 293 | 296 |
| 294 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 297 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
| 295 }; | 298 }; |
| 296 | 299 |
| 297 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 300 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| OLD | NEW |