chromium/chrome/browser/search/search.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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"  // nogncheck
#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) {}

}  // namespace

// Returns true if |my_url| matches |other_url| in terms of origin (i.e. host,
// port, and scheme) and path.
// Defined outside of the anonymous namespace so that it's accessible to unit
// tests.
bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) {}

namespace {

// Status of the New Tab URL for the default Search provider. NOTE: Used in a
// UMA histogram so values should only be added at the end and not reordered.
enum NewTabURLState {};

const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {}

bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) {}

// Returns true if |url| matches the NTP URL or the URL of the NTP's associated
// service worker.
bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) {}

bool IsURLAllowedForSupervisedUser(const GURL& url, Profile& profile) {}

// 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 {};

bool IsRenderedInInstantProcess(content::WebContents* contents,
                                Profile* profile) {}

}  // namespace

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  // !BUILDFLAG(IS_ANDROID)

}  // namespace search