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

Unified Diff: chrome/browser/engagement/site_engagement_service.cc

Issue 1207383006: Add GetTotalEngagementPoints to SiteEngagementService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/engagement/site_engagement_service.cc
diff --git a/chrome/browser/engagement/site_engagement_service.cc b/chrome/browser/engagement/site_engagement_service.cc
index 2885fbfc99fce5ca781d3de6d15448270fbb09da..0071552ef52e08012f894e330570cfb5e93e0554 100644
--- a/chrome/browser/engagement/site_engagement_service.cc
+++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -192,3 +192,17 @@ int SiteEngagementService::GetScore(const GURL& url) {
return score.Score();
}
+int SiteEngagementService::GetTotalEngagementPoints() {
+ HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap();
+ ContentSettingsForOneType engagement_settings;
+ settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
+ std::string(), &engagement_settings);
+ int total_score = 0;
+ for (auto it : engagement_settings) {
raymes 2015/07/01 05:33:08 perhaps for (auto site : engagement_settings) Al
calamity 2015/07/06 01:51:06 Done.
+ scoped_ptr<base::DictionaryValue> settings =
+ GetOriginDict(settings_map, GURL(it.primary_pattern.ToString()));
raymes 2015/07/01 05:33:09 I guess we should technically check that the GURL
calamity 2015/07/06 01:51:06 Done.
+ SiteEngagementScore score(&clock_, *settings);
+ total_score += score.Score();
+ }
+ return total_score;
+}

Powered by Google App Engine
This is Rietveld 408576698