#include "chrome/browser/search/search.h"
#include <stddef.h>
#include <string>
#include "base/check_deref.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "components/google/core/common/google_util.h"
#include "components/search/ntp_features.h"
#include "components/search/search.h"
#include "components/search_engines/search_engine_type.h"
#include "components/search_engines/template_url_service.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "components/supervised_user/core/browser/supervised_user_url_filter.h"
#include "components/supervised_user/core/browser/supervised_user_utils.h"
#include "components/supervised_user/core/common/buildflags.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "url/gurl.h"
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h"
#include "chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.h"
#endif
namespace search {
namespace {
const char kServiceWorkerFileName[] = …;
bool MatchesOrigin(const GURL& my_url, const GURL& other_url) { … }
}
bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) { … }
namespace {
enum NewTabURLState { … };
const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) { … }
bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) { … }
bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) { … }
bool IsURLAllowedForSupervisedUser(const GURL& url, Profile& profile) { … }
struct NewTabURLDetails { … };
bool IsRenderedInInstantProcess(content::WebContents* contents,
Profile* profile) { … }
}
bool DefaultSearchProviderIsGoogle(Profile* profile) { … }
bool IsNTPOrRelatedURL(const GURL& url, Profile* profile) { … }
bool IsNTPURL(const GURL& url) { … }
bool IsInstantNTP(content::WebContents* contents) { … }
bool NavEntryIsInstantNTP(content::WebContents* contents,
content::NavigationEntry* entry) { … }
bool IsInstantNTPURL(const GURL& url, Profile* profile) { … }
GURL GetNewTabPageURL(Profile* profile) { … }
#if !BUILDFLAG(IS_ANDROID)
bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { … }
bool ShouldUseProcessPerSiteForInstantSiteURL(const GURL& site_url,
Profile* profile) { … }
GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) { … }
bool HandleNewTabURLRewrite(GURL* url,
content::BrowserContext* browser_context) { … }
bool HandleNewTabURLReverseRewrite(GURL* url,
content::BrowserContext* browser_context) { … }
#endif
}