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

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

Issue 1316043003: Add chrome://site-engagement WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation_smarter
Patch Set: fix dependencies Created 5 years, 3 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 #include "chrome/browser/engagement/site_engagement_service.h" 5 #include "chrome/browser/engagement/site_engagement_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (!origin.is_valid()) 209 if (!origin.is_valid())
210 continue; 210 continue;
211 211
212 scoped_ptr<base::DictionaryValue> score_dict = 212 scoped_ptr<base::DictionaryValue> score_dict =
213 GetScoreDictForOrigin(settings_map, origin); 213 GetScoreDictForOrigin(settings_map, origin);
214 SiteEngagementScore score(&clock_, *score_dict); 214 SiteEngagementScore score(&clock_, *score_dict);
215 total_score += score.Score(); 215 total_score += score.Score();
216 } 216 }
217 return total_score; 217 return total_score;
218 } 218 }
219
220 std::map<GURL, int> SiteEngagementService::GetScoreMap() {
221 std::map<GURL, int> score_map;
222 HostContentSettingsMap* settings_map =
223 HostContentSettingsMapFactory::GetForProfile(profile_);
224 ContentSettingsForOneType engagement_settings;
225 settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
226 std::string(), &engagement_settings);
227 for (const auto& site : engagement_settings) {
228 GURL origin(site.primary_pattern.ToString());
229 if (!origin.is_valid())
230 continue;
231
232 scoped_ptr<base::DictionaryValue> score_dict =
233 GetScoreDictForOrigin(settings_map, origin);
234 SiteEngagementScore score(&clock_, *score_dict);
235 score_map[origin] = score.Score();
236 }
237 return score_map;
238 }
OLDNEW
« no previous file with comments | « chrome/browser/engagement/site_engagement_service.h ('k') | chrome/browser/resources/engagement/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698