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

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

Issue 2748103011: Grant origins engagement for having interactions on their notifications. (Closed)
Patch Set: Unfriend Created 3 years, 9 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
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 explicit SiteEngagementService(Profile* profile); 105 explicit SiteEngagementService(Profile* profile);
106 ~SiteEngagementService() override; 106 ~SiteEngagementService() override;
107 107
108 // Returns the engagement level of |url|. 108 // Returns the engagement level of |url|.
109 blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url) const; 109 blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url) const;
110 110
111 // Returns a map of all stored origins and their engagement scores. 111 // Returns a map of all stored origins and their engagement scores.
112 std::map<GURL, double> GetScoreMap() const; 112 std::map<GURL, double> GetScoreMap() const;
113 113
114 // Update the engagement score of |url| for a notification interaction.
115 void HandleNotificationInteraction(const GURL& url);
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;
118 121
119 // Returns whether |url| has at least the given |level| of engagement. 122 // Returns whether |url| has at least the given |level| of engagement.
120 bool IsEngagementAtLeast(const GURL& url, 123 bool IsEngagementAtLeast(const GURL& url,
121 blink::mojom::EngagementLevel level) const; 124 blink::mojom::EngagementLevel level) const;
122 125
123 // Resets the base engagement for |url| to |score|, clearing daily limits. Any 126 // Resets the base engagement for |url| to |score|, clearing daily limits. Any
(...skipping 20 matching lines...) Expand all
144 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, 147 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
145 CleanupMovesScoreBackToNow); 148 CleanupMovesScoreBackToNow);
146 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, 149 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
147 CleanupMovesScoreBackToRebase); 150 CleanupMovesScoreBackToRebase);
148 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, 151 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
149 CleanupEngagementScoresProportional); 152 CleanupEngagementScoresProportional);
150 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ClearHistoryForURLs); 153 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ClearHistoryForURLs);
151 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement); 154 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement);
152 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints); 155 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints);
153 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints); 156 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints);
157 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
158 GetTotalNotificationPoints);
154 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, RestrictedToHTTPAndHTTPS); 159 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, RestrictedToHTTPAndHTTPS);
155 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); 160 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch);
156 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, NotificationPermission); 161 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, NotificationPermission);
157 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, 162 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
158 CleanupOriginsOnHistoryDeletion); 163 CleanupOriginsOnHistoryDeletion);
159 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped); 164 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped);
160 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel); 165 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel);
161 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, Observers); 166 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, Observers);
162 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); 167 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms);
163 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastEngagementTime); 168 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastEngagementTime);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // A list of observers. When any origin registers an engagement-increasing 293 // A list of observers. When any origin registers an engagement-increasing
289 // event, each observer's OnEngagementIncreased method will be called. 294 // event, each observer's OnEngagementIncreased method will be called.
290 base::ObserverList<SiteEngagementObserver> observer_list_; 295 base::ObserverList<SiteEngagementObserver> observer_list_;
291 296
292 base::WeakPtrFactory<SiteEngagementService> weak_factory_; 297 base::WeakPtrFactory<SiteEngagementService> weak_factory_;
293 298
294 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); 299 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService);
295 }; 300 };
296 301
297 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ 302 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/engagement/site_engagement_score.cc ('k') | chrome/browser/engagement/site_engagement_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698