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

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

Issue 2938163002: Store base::Value in ContentSettingPatternSource instead of an enum (Closed)
Patch Set: rebased Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/important_sites_util.h" 5 #include "chrome/browser/engagement/important_sites_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 std::map<std::string, ImportantDomainInfo>* output) { 257 std::map<std::string, ImportantDomainInfo>* output) {
258 // Grab our content settings list. 258 // Grab our content settings list.
259 ContentSettingsForOneType content_settings_list; 259 ContentSettingsForOneType content_settings_list;
260 HostContentSettingsMapFactory::GetForProfile(profile)->GetSettingsForOneType( 260 HostContentSettingsMapFactory::GetForProfile(profile)->GetSettingsForOneType(
261 content_type, content_settings::ResourceIdentifier(), 261 content_type, content_settings::ResourceIdentifier(),
262 &content_settings_list); 262 &content_settings_list);
263 // Extract a set of urls, using the primary pattern. We don't handle 263 // Extract a set of urls, using the primary pattern. We don't handle
264 // wildcard patterns. 264 // wildcard patterns.
265 std::set<GURL> content_origins; 265 std::set<GURL> content_origins;
266 for (const ContentSettingPatternSource& site : content_settings_list) { 266 for (const ContentSettingPatternSource& site : content_settings_list) {
267 if (site.setting != CONTENT_SETTING_ALLOW) 267 if (site.GetContentSetting() != CONTENT_SETTING_ALLOW)
268 continue; 268 continue;
269 MaybePopulateImportantInfoForReason(GURL(site.primary_pattern.ToString()), 269 MaybePopulateImportantInfoForReason(GURL(site.primary_pattern.ToString()),
270 &content_origins, reason, output); 270 &content_origins, reason, output);
271 } 271 }
272 } 272 }
273 273
274 void PopulateInfoMapWithBookmarks( 274 void PopulateInfoMapWithBookmarks(
275 Profile* profile, 275 Profile* profile,
276 const std::map<GURL, double>& engagement_map, 276 const std::map<GURL, double>& engagement_map,
277 std::map<std::string, ImportantDomainInfo>* output) { 277 std::map<std::string, ImportantDomainInfo>* output) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const GURL& origin) { 486 const GURL& origin) {
487 SiteEngagementScore::SetParamValuesForTesting(); 487 SiteEngagementScore::SetParamValuesForTesting();
488 // First get data from site engagement. 488 // First get data from site engagement.
489 SiteEngagementService* site_engagement_service = 489 SiteEngagementService* site_engagement_service =
490 SiteEngagementService::Get(profile); 490 SiteEngagementService::Get(profile);
491 site_engagement_service->ResetBaseScoreForURL( 491 site_engagement_service->ResetBaseScoreForURL(
492 origin, SiteEngagementScore::GetMediumEngagementBoundary()); 492 origin, SiteEngagementScore::GetMediumEngagementBoundary());
493 DCHECK(site_engagement_service->IsEngagementAtLeast( 493 DCHECK(site_engagement_service->IsEngagementAtLeast(
494 origin, blink::mojom::EngagementLevel::MEDIUM)); 494 origin, blink::mojom::EngagementLevel::MEDIUM));
495 } 495 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698