OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_ |
| 7 |
| 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" |
| 10 |
| 11 class GURL; |
| 12 class SiteEngagementService; |
| 13 |
| 14 class SiteEngagementObserver { |
| 15 public: |
| 16 // Called when the engagement for |url| increases to |score|. |
| 17 // This may be run on user input, so observers *must not* perform any |
| 18 // expensive tasks in this callback. |
| 19 virtual void OnEngagementIncreased(const SiteEngagementService* service, |
| 20 const GURL& url, |
| 21 double score) {} |
| 22 |
| 23 protected: |
| 24 explicit SiteEngagementObserver(SiteEngagementService* service); |
| 25 |
| 26 SiteEngagementObserver(); |
| 27 |
| 28 ~SiteEngagementObserver(); |
| 29 |
| 30 // Begin observing |service| for engagement increases. |
| 31 // To stop observing, call Observe(nullptr). |
| 32 void Observe(SiteEngagementService* service); |
| 33 |
| 34 private: |
| 35 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, Observers); |
| 36 SiteEngagementService* service_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(SiteEngagementObserver); |
| 39 |
| 40 }; |
| 41 |
| 42 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_ |
OLD | NEW |