| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 // Returns whether the engagement service has enough data to make meaningful | 114 // Returns whether the engagement service has enough data to make meaningful |
| 115 // decisions. Clients should avoid using engagement in their heuristic until | 115 // decisions. Clients should avoid using engagement in their heuristic until |
| 116 // this is true. | 116 // this is true. |
| 117 bool IsBootstrapped() const; | 117 bool IsBootstrapped() const; |
| 118 | 118 |
| 119 // Returns whether |url| has at least the given |level| of engagement. | 119 // Returns whether |url| has at least the given |level| of engagement. |
| 120 bool IsEngagementAtLeast(const GURL& url, | 120 bool IsEngagementAtLeast(const GURL& url, |
| 121 blink::mojom::EngagementLevel level) const; | 121 blink::mojom::EngagementLevel level) const; |
| 122 | 122 |
| 123 // Resets the engagement score |url| to |score|, clearing daily limits. | 123 // Resets the base engagement for |url| to |score|, clearing daily limits. Any |
| 124 void ResetScoreForURL(const GURL& url, double score); | 124 // bonus engagement that |url| has acquired is not affected by this method, so |
| 125 // the result of GetScore(|url|) may not be the same as |score|. |
| 126 void ResetBaseScoreForURL(const GURL& url, double score); |
| 125 | 127 |
| 126 // Update the last time |url| was opened from an installed shortcut to be | 128 // Update the last time |url| was opened from an installed shortcut to be |
| 127 // clock_->Now(). | 129 // clock_->Now(). |
| 128 void SetLastShortcutLaunchTime(const GURL& url); | 130 void SetLastShortcutLaunchTime(const GURL& url); |
| 129 | 131 |
| 130 void HelperCreated(SiteEngagementService::Helper* helper); | 132 void HelperCreated(SiteEngagementService::Helper* helper); |
| 131 void HelperDeleted(SiteEngagementService::Helper* helper); | 133 void HelperDeleted(SiteEngagementService::Helper* helper); |
| 132 | 134 |
| 133 // Overridden from SiteEngagementScoreProvider. | 135 // Overridden from SiteEngagementScoreProvider. |
| 134 double GetScore(const GURL& url) const override; | 136 double GetScore(const GURL& url) const override; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // A list of observers. When any origin registers an engagement-increasing | 288 // A list of observers. When any origin registers an engagement-increasing |
| 287 // event, each observer's OnEngagementIncreased method will be called. | 289 // event, each observer's OnEngagementIncreased method will be called. |
| 288 base::ObserverList<SiteEngagementObserver> observer_list_; | 290 base::ObserverList<SiteEngagementObserver> observer_list_; |
| 289 | 291 |
| 290 base::WeakPtrFactory<SiteEngagementService> weak_factory_; | 292 base::WeakPtrFactory<SiteEngagementService> weak_factory_; |
| 291 | 293 |
| 292 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 294 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
| 293 }; | 295 }; |
| 294 | 296 |
| 295 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 297 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| OLD | NEW |