Chromium Code Reviews| Index: chrome/browser/engagement/site_engagement_observer.h |
| diff --git a/chrome/browser/engagement/site_engagement_observer.h b/chrome/browser/engagement/site_engagement_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5ecc4214e5b907c24c9a445e61a97792c4e6f5ef |
| --- /dev/null |
| +++ b/chrome/browser/engagement/site_engagement_observer.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_ |
| +#define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_ |
| + |
| +#include "base/gtest_prod_util.h" |
| +#include "base/macros.h" |
| + |
| +class GURL; |
| +class SiteEngagementService; |
| + |
| +class SiteEngagementObserver { |
| + public: |
| + // Called when the engagement for |url| increases to |score|. |
| + // This may be run on user input, so observers *must not* perform any |
| + // expensive tasks in this callback. |
| + virtual void OnEngagementIncreased(const SiteEngagementService* service, |
| + const GURL& url, |
|
benwells
2016/06/01 01:44:45
can you use a url::Origin here instead?
There is
dominickn
2016/06/01 02:54:13
Do you think that the observer should only be info
benwells
2016/06/01 03:35:50
Hmm ... I hadn't considered that. It feels a bit s
|
| + double score) {} |
| + |
| + protected: |
| + explicit SiteEngagementObserver(SiteEngagementService* service); |
| + |
| + SiteEngagementObserver(); |
| + |
| + ~SiteEngagementObserver(); |
| + |
| + // Begin observing |service| for engagement increases. |
| + // To stop observing, call Observe(nullptr). |
| + void Observe(SiteEngagementService* service); |
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, Observers); |
| + SiteEngagementService* service_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SiteEngagementObserver); |
| + |
| +}; |
| + |
| +#endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_ |