Index: chrome/browser/android/preferences/important_sites_util.cc |
diff --git a/chrome/browser/android/preferences/important_sites_util.cc b/chrome/browser/android/preferences/important_sites_util.cc |
index ef09b81fc6efc59fd4df1c89c0ce6925e805ac0a..0fdf05ba1480dcdd08b4f4c3d84b00b441b8f097 100644 |
--- a/chrome/browser/android/preferences/important_sites_util.cc |
+++ b/chrome/browser/android/preferences/important_sites_util.cc |
@@ -9,6 +9,7 @@ |
#include <set> |
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
+#include "chrome/browser/engagement/site_engagement_score.h" |
#include "chrome/browser/engagement/site_engagement_service.h" |
#include "components/content_settings/core/browser/host_content_settings_map.h" |
#include "components/content_settings/core/common/content_settings.h" |
@@ -84,6 +85,8 @@ void FillTopRegisterableDomains( |
net::registry_controlled_domains::GetDomainAndRegistry( |
pair.first, |
net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
+ if (registerable_domain.empty() && pair.first.HostIsIPAddress()) |
+ registerable_domain = pair.first.host(); |
// Just iterate to find, as we assume our size is small. |
if (std::find(final_list->begin(), final_list->end(), |
registerable_domain) == final_list->end()) { |
@@ -125,3 +128,14 @@ std::vector<std::string> ImportantSitesUtil::GetImportantRegisterableDomains( |
&final_list); |
return final_list; |
} |
+ |
+void ImportantSitesUtil::MarkOriginAsImportantForTesting(Profile* profile, |
+ const GURL& origin) { |
+ // First get data from site engagement. |
+ SiteEngagementService* site_engagement_service = |
+ SiteEngagementService::Get(profile); |
+ site_engagement_service->ResetScoreForURL( |
+ origin, SiteEngagementScore::GetMediumEngagementBoundary()); |
+ DCHECK(site_engagement_service->IsEngagementAtLeast( |
+ origin, SiteEngagementService::ENGAGEMENT_LEVEL_MEDIUM)); |
+} |