LeOSium_webview/LeOS/patches/Restore-classic-new-tab-pag...

88 lines
3.2 KiB
Diff
Raw Normal View History

2023-11-18 11:46:19 +01:00
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sun, 26 Nov 2017 11:40:05 +0100
Subject: Restore classic new tab page
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/browser/search/search.cc | 51 +--------------------------------
1 file changed, 1 insertion(+), 50 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
@@ -95,16 +95,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))
@@ -138,25 +128,6 @@ bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) {
IsMatchingServiceWorker(url, new_tab_url));
}
-bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) {
-#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
- supervised_user::SupervisedUserService* supervised_user_service =
- SupervisedUserServiceFactory::GetForProfile(profile);
- if (!supervised_user_service ||
- !supervised_user_service->IsURLFilteringEnabled()) {
- return true;
- }
-
- supervised_user::SupervisedUserURLFilter* url_filter =
- supervised_user_service->GetURLFilter();
- if (url_filter->GetFilteringBehaviorForURL(url) ==
- supervised_user::SupervisedUserURLFilter::BLOCK) {
- return false;
- }
-#endif
- return true;
-}
-
// 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 {
@@ -178,28 +149,8 @@ struct NewTabURLDetails {
const GURL local_url(default_is_google
? chrome::kChromeUINewTabPageURL
: chrome::kChromeUINewTabPageThirdPartyURL);
- if (default_is_google) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
- }
#endif
-
- const TemplateURL* template_url =
- GetDefaultSearchProviderTemplateURL(profile);
- if (!profile || !template_url)
- return NewTabURLDetails(local_url, NEW_TAB_URL_BAD);
-
- GURL search_provider_url(template_url->new_tab_url_ref().ReplaceSearchTerms(
- TemplateURLRef::SearchTermsArgs(std::u16string()),
- UIThreadSearchTermsData()));
-
- if (!search_provider_url.is_valid())
- return NewTabURLDetails(local_url, NEW_TAB_URL_NOT_SET);
- if (!search_provider_url.SchemeIsCryptographic())
- return NewTabURLDetails(local_url, NEW_TAB_URL_INSECURE);
- 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(local_url, NEW_TAB_URL_VALID);
}
const GURL url;
--
2.25.1