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

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

Issue 2716333002: Implement important sites dialog for desktop. (Closed)
Patch Set: move filter creation back, add notification status Created 3 years, 9 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 GURL origin(site.primary_pattern.ToString()); 343 GURL origin(site.primary_pattern.ToString());
344 if (!AppBannerSettingsHelper::WasLaunchedRecently(profile, origin, now)) 344 if (!AppBannerSettingsHelper::WasLaunchedRecently(profile, origin, now))
345 continue; 345 continue;
346 MaybePopulateImportantInfoForReason(origin, &content_origins, 346 MaybePopulateImportantInfoForReason(origin, &content_origins,
347 ImportantReason::HOME_SCREEN, output); 347 ImportantReason::HOME_SCREEN, output);
348 } 348 }
349 } 349 }
350 350
351 } // namespace 351 } // namespace
352 352
353 bool ImportantSitesUtil::HasNotifications(const ImportantDomainInfo& info) {
354 return (info.reason_bitfield & (1 << ImportantReason::NOTIFICATIONS)) != 0;
355 }
356
353 bool ImportantSitesUtil::IsDialogDisabled(Profile* profile) { 357 bool ImportantSitesUtil::IsDialogDisabled(Profile* profile) {
354 PrefService* service = profile->GetPrefs(); 358 PrefService* service = profile->GetPrefs();
355 DictionaryPrefUpdate update(service, prefs::kImportantSitesDialogHistory); 359 DictionaryPrefUpdate update(service, prefs::kImportantSitesDialogHistory);
356 360
357 return ShouldSuppressItem(update.Get()); 361 return ShouldSuppressItem(update.Get());
358 } 362 }
359 363
360 void ImportantSitesUtil::RegisterProfilePrefs( 364 void ImportantSitesUtil::RegisterProfilePrefs(
361 user_prefs::PrefRegistrySyncable* registry) { 365 user_prefs::PrefRegistrySyncable* registry) {
362 registry->RegisterDictionaryPref(prefs::kImportantSitesDialogHistory); 366 registry->RegisterDictionaryPref(prefs::kImportantSitesDialogHistory);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 const GURL& origin) { 485 const GURL& origin) {
482 SiteEngagementScore::SetParamValuesForTesting(); 486 SiteEngagementScore::SetParamValuesForTesting();
483 // First get data from site engagement. 487 // First get data from site engagement.
484 SiteEngagementService* site_engagement_service = 488 SiteEngagementService* site_engagement_service =
485 SiteEngagementService::Get(profile); 489 SiteEngagementService::Get(profile);
486 site_engagement_service->ResetScoreForURL( 490 site_engagement_service->ResetScoreForURL(
487 origin, SiteEngagementScore::GetMediumEngagementBoundary()); 491 origin, SiteEngagementScore::GetMediumEngagementBoundary());
488 DCHECK(site_engagement_service->IsEngagementAtLeast( 492 DCHECK(site_engagement_service->IsEngagementAtLeast(
489 origin, blink::mojom::EngagementLevel::MEDIUM)); 493 origin, blink::mojom::EngagementLevel::MEDIUM));
490 } 494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698