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

Unified Diff: chrome/browser/engagement/site_engagement_score.h

Issue 2788413003: Add SiteEngagementService::GetAllDetails(), to return detailed scores. (Closed)
Patch Set: Fix notifications permission logic & test Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/engagement/site_engagement_score.h
diff --git a/chrome/browser/engagement/site_engagement_score.h b/chrome/browser/engagement/site_engagement_score.h
index 358f97d6cf79dfcee6ac4703bc3b7c15b3654758..517520a1f7deb88ba26b56925506b0244313770d 100644
--- a/chrome/browser/engagement/site_engagement_score.h
+++ b/chrome/browser/engagement/site_engagement_score.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "base/values.h"
+#include "chrome/browser/engagement/site_engagement_details.mojom.h"
#include "third_party/WebKit/public/platform/site_engagement.mojom.h"
#include "url/gurl.h"
@@ -137,7 +138,15 @@ class SiteEngagementScore {
// possible score. Decays the score if it has not been updated recently
// enough.
void AddPoints(double points);
- double GetScore() const;
+
+ // Returns the total score, taking into account the base, bonus and maximum
+ // values.
+ double GetTotalScore() const;
+
+ // Returns a structure containing the origin URL and score, and details
+ // of the base and bonus scores. Note that the |score| is limited to
+ // kMaxPoints, while the detailed scores are returned raw.
+ mojom::SiteEngagementDetails GetDetails() const;
dcheng 2017/04/11 05:28:06 FWIW, this seems potentially dicey. I think this i
Wez 2017/04/11 19:57:07 Checked w/ yzshen: Intention is that Mojo structs
// Writes the values in this score into |settings_map_|.
void Commit();
@@ -196,8 +205,11 @@ class SiteEngagementScore {
// Determine the score, accounting for any decay.
double DecayedScore() const;
- // Determine any score bonus from having installed shortcuts.
- double BonusScore() const;
+ // Determine bonus from being installed, and having been launched recently..
+ double BonusIfShortcutLaunched() const;
+
+ // Determine bonus from having been granted notifications permission.
+ double BonusIfHasNotifications() const;
// Updates the content settings dictionary |score_dict| with the current score
// fields. Returns true if |score_dict| changed, otherwise return false.

Powered by Google App Engine
This is Rietveld 408576698