Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/engagement/site_engagement_observer.h

Issue 1986033002: Implement an observer interface for the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@site-engagement-refactor
Patch Set: Addressing reviewer comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 namespace content {
12 class WebContents;
13 }
14
15 class GURL;
16 class SiteEngagementService;
17
18 class SiteEngagementObserver {
19 public:
20 // Called when the engagement for |url| loaded in |web_contents| increases to
21 // |score|. |is_hidden| is true if the engagement occurred when |web_contents|
22 // was hidden (e.g. in the background).
23 // This method may be run on user input, so observers *must not* perform any
24 // expensive tasks here.
25 virtual void OnEngagementIncreased(content::WebContents* web_contents,
26 const GURL& url,
27 double score) {}
28
29 protected:
30 explicit SiteEngagementObserver(SiteEngagementService* service);
31
32 SiteEngagementObserver();
33
34 ~SiteEngagementObserver();
35
36 // Returns the site engagement service which this object is observing.
37 SiteEngagementService* GetSiteEngagementService() const;
38
39 // Begin observing |service| for engagement increases.
40 // To stop observing, call Observe(nullptr).
41 void Observe(SiteEngagementService* service);
42
43 private:
44 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, Observers);
45 SiteEngagementService* service_;
46
47 DISALLOW_COPY_AND_ASSIGN(SiteEngagementObserver);
48 };
49
50 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698