Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "components/keyed_service/core/keyed_service.h" | |
| 12 | |
| 13 class GURL; | |
| 14 class Profile; | |
| 15 | |
| 16 // Stores and retrieves the engagement score of a origin. | |
|
raymes
2015/04/16 01:13:55
nit: an origin
benwells
2015/04/16 05:15:27
Done.
| |
| 17 // | |
| 18 // An engagement score is a positive integer that represents how much a user has | |
| 19 // engaged with a origin - the higher it is, the more engagement the user has | |
|
raymes
2015/04/16 01:13:55
nit: an origin
benwells
2015/04/16 05:15:27
Done.
| |
| 20 // had with this site recently. | |
| 21 // | |
| 22 // Positive user activity, such as visiting the origin often and adding it to | |
| 23 // the homescreen, will increase the site engagement score. Negative activity, | |
| 24 // such as rejecting permission prompts or not responding to notifications, will | |
| 25 // decrease the site engagement score. | |
| 26 class SiteEngagementService : public KeyedService { | |
| 27 public: | |
| 28 static SiteEngagementService* Get(Profile* profile); | |
| 29 | |
| 30 // Returns whether or not the SiteEngagementService is enabled. | |
| 31 static bool IsEnabled(); | |
| 32 | |
| 33 explicit SiteEngagementService(Profile* profile); | |
| 34 ~SiteEngagementService() override; | |
| 35 | |
| 36 // Update the karma score of the origin matching |url| for user navigation. | |
| 37 void HandleNavigation(const GURL& url); | |
| 38 | |
| 39 // Returns a non-negative integer representing the engagement score of the | |
| 40 // origin for this URL. | |
| 41 int GetScore(const GURL& url); | |
| 42 | |
| 43 private: | |
| 44 Profile* profile_; | |
| 45 | |
| 46 // Temporary non-persistent score database for testing. | |
| 47 std::map<GURL, int> scores_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | |
| OLD | NEW |