bromite/build/patches/Restore-classic-new-tab-page.patch
2021-01-26 01:12:38 +01:00

85 lines
2.8 KiB
Diff

From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sun, 26 Nov 2017 11:40:05 +0100
Subject: Restore classic new tab page
---
chrome/browser/search/search.cc | 42 +++------------------------------
1 file changed, 3 insertions(+), 39 deletions(-)
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -91,16 +91,6 @@ enum NewTabURLState {
NEW_TAB_URL_MAX
};
-const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {
- if (profile) {
- TemplateURLService* template_url_service =
- TemplateURLServiceFactory::GetForProfile(profile);
- if (template_url_service)
- return template_url_service->GetDefaultSearchProvider();
- }
- return nullptr;
-}
-
bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) {
// The origin should match.
if (!MatchesOrigin(my_url, document_url))
@@ -140,31 +130,6 @@ GURL RemoveQueryParam(const GURL& url) {
return url.ReplaceComponents(replacements);
}
-bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) {
-#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
- // If this isn't a supervised user, skip the URL filter check, since it can be
- // fairly expensive.
- if (!profile->IsSupervised())
- return true;
- SupervisedUserService* supervised_user_service =
- SupervisedUserServiceFactory::GetForProfile(profile);
- SupervisedUserURLFilter* url_filter = supervised_user_service->GetURLFilter();
- if (url_filter->GetFilteringBehaviorForURL(url) ==
- SupervisedUserURLFilter::BLOCK) {
- return false;
- }
-#endif
- return true;
-}
-
-bool ShouldShowLocalNewTab(Profile* profile) {
-#if !defined(OS_ANDROID)
- return DefaultSearchProviderIsGoogle(profile);
-#else
- return false;
-#endif
-}
-
// Used to look up the URL to use for the New Tab page. Also tracks how we
// arrived at that URL so it can be logged with UMA.
struct NewTabURLDetails {
@@ -187,10 +152,9 @@ struct NewTabURLDetails {
: chrome::kChromeSearchLocalNtpUrl);
#endif
- if (ShouldShowLocalNewTab(profile))
- return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
+ return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
- const TemplateURL* template_url =
+/* const TemplateURL* template_url =
GetDefaultSearchProviderTemplateURL(profile);
if (!profile || !template_url)
return NewTabURLDetails(local_url, NEW_TAB_URL_BAD);
@@ -206,7 +170,7 @@ struct NewTabURLDetails {
if (!IsURLAllowedForSupervisedUser(search_provider_url, profile))
return NewTabURLDetails(local_url, NEW_TAB_URL_BLOCKED);
- return NewTabURLDetails(search_provider_url, NEW_TAB_URL_VALID);
+ return NewTabURLDetails(search_provider_url, NEW_TAB_URL_VALID);*/
}
const GURL url;
--
2.17.1