#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/history/top_sites_factory.h"
#include <stddef.h>
#include <memory>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/engagement/site_engagement_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/history_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
#include "chrome/grit/theme_resources.h"
#include "components/grit/components_scaled_resources.h"
#include "components/history/core/browser/history_constants.h"
#include "components/history/core/browser/top_sites_impl.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/search/ntp_features.h"
#include "components/search_engines/template_url_service.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
namespace {
const char kDisableTopSites[] = …;
bool IsTopSitesDisabled() { … }
struct RawPrepopulatedPage { … };
#if !BUILDFLAG(IS_ANDROID)
const RawPrepopulatedPage kRawPrepopulatedPages[] = …;
#endif
void InitializePrepopulatedPageList(
Profile* profile,
history::PrepopulatedPageList* prepopulated_pages) { … }
}
scoped_refptr<history::TopSites> TopSitesFactory::GetForProfile(
Profile* profile) { … }
TopSitesFactory* TopSitesFactory::GetInstance() { … }
scoped_refptr<history::TopSites> TopSitesFactory::BuildTopSites(
content::BrowserContext* context,
const std::vector<history::PrepopulatedPage>& prepopulated_page_list) { … }
TopSitesFactory::TopSitesFactory()
: … { … }
TopSitesFactory::~TopSitesFactory() = default;
scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { … }
void TopSitesFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
bool TopSitesFactory::ServiceIsNULLWhileTesting() const { … }