chromium/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc

// Copyright 2014 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/autocomplete/chrome_autocomplete_provider_client.h"

#include <stddef.h>

#include <algorithm>

#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/cstring_view.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
#include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
#include "chrome/browser/autocomplete/provider_state_service_factory.h"
#include "chrome/browser/autocomplete/remote_suggestions_service_factory.h"
#include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
#include "chrome/browser/autocomplete/zero_suggest_cache_service_factory.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/history_clusters/history_clusters_service_factory.h"
#include "chrome/browser/history_embeddings/history_embeddings_service_factory.h"
#include "chrome/browser/history_embeddings/history_embeddings_utils.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/omnibox/omnibox_pedal_implementations.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/top_sites.h"
#include "components/history/core/common/pref_names.h"
#include "components/history_clusters/core/features.h"
#include "components/language/core/browser/pref_names.h"
#include "components/omnibox/browser/actions/omnibox_pedal_provider.h"
#include "components/omnibox/browser/autocomplete_classifier.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/omnibox_triggered_feature_service.h"
#include "components/omnibox/browser/shortcuts_backend.h"
#include "components/omnibox/browser/tab_matcher.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/sync/service/sync_service.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "extensions/buildflags/buildflags.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/origin.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/app_list/search/essential_search/essential_search_manager.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#endif

#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h"
#endif

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/side_panel/history_clusters/history_clusters_side_panel_coordinator.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h"
#endif

#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "chrome/browser/autocomplete/autocomplete_scoring_model_service_factory.h"
#include "chrome/browser/autocomplete/on_device_tail_model_service_factory.h"
#include "components/omnibox/browser/autocomplete_scoring_model_service.h"
#include "components/omnibox/browser/on_device_tail_model_service.h"
#endif  // BUILDFLAG(BUILD_WITH_TFLITE_LIB)

namespace {

#if !BUILDFLAG(IS_ANDROID)
// This list should be kept in sync with chrome/common/webui_url_constants.h.
// Only include useful sub-pages, confirmation alerts are not useful.
constexpr auto kChromeSettingsSubPages =;
#endif  // BUILDFLAG(IS_ANDROID)

}  // namespace

ChromeAutocompleteProviderClient::ChromeAutocompleteProviderClient(
    Profile* profile)
    :{}

ChromeAutocompleteProviderClient::~ChromeAutocompleteProviderClient() = default;

scoped_refptr<network::SharedURLLoaderFactory>
ChromeAutocompleteProviderClient::GetURLLoaderFactory() {}

PrefService* ChromeAutocompleteProviderClient::GetPrefs() const {}

PrefService* ChromeAutocompleteProviderClient::GetLocalState() {}

std::string ChromeAutocompleteProviderClient::GetApplicationLocale() const {}

const AutocompleteSchemeClassifier&
ChromeAutocompleteProviderClient::GetSchemeClassifier() const {}

AutocompleteClassifier*
ChromeAutocompleteProviderClient::GetAutocompleteClassifier() {}

history::HistoryService* ChromeAutocompleteProviderClient::GetHistoryService() {}

history_clusters::HistoryClustersService*
ChromeAutocompleteProviderClient::GetHistoryClustersService() {}

history_embeddings::HistoryEmbeddingsService*
ChromeAutocompleteProviderClient::GetHistoryEmbeddingsService() {}

scoped_refptr<history::TopSites>
ChromeAutocompleteProviderClient::GetTopSites() {}

bookmarks::BookmarkModel* ChromeAutocompleteProviderClient::GetBookmarkModel() {}

history::URLDatabase* ChromeAutocompleteProviderClient::GetInMemoryDatabase() {}

InMemoryURLIndex* ChromeAutocompleteProviderClient::GetInMemoryURLIndex() {}

TemplateURLService* ChromeAutocompleteProviderClient::GetTemplateURLService() {}

const TemplateURLService*
ChromeAutocompleteProviderClient::GetTemplateURLService() const {}

RemoteSuggestionsService*
ChromeAutocompleteProviderClient::GetRemoteSuggestionsService(
    bool create_if_necessary) const {}

ZeroSuggestCacheService*
ChromeAutocompleteProviderClient::GetZeroSuggestCacheService() {}

const ZeroSuggestCacheService*
ChromeAutocompleteProviderClient::GetZeroSuggestCacheService() const {}

OmniboxPedalProvider* ChromeAutocompleteProviderClient::GetPedalProvider()
    const {}

scoped_refptr<ShortcutsBackend>
ChromeAutocompleteProviderClient::GetShortcutsBackend() {}

scoped_refptr<ShortcutsBackend>
ChromeAutocompleteProviderClient::GetShortcutsBackendIfExists() {}

std::unique_ptr<KeywordExtensionsDelegate>
ChromeAutocompleteProviderClient::GetKeywordExtensionsDelegate(
    KeywordProvider* keyword_provider) {}

std::string ChromeAutocompleteProviderClient::GetAcceptLanguages() const {}

std::string
ChromeAutocompleteProviderClient::GetEmbedderRepresentationOfAboutScheme()
    const {}

std::vector<std::u16string> ChromeAutocompleteProviderClient::GetBuiltinURLs() {}

std::vector<std::u16string>
ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() {}

component_updater::ComponentUpdateService*
ChromeAutocompleteProviderClient::GetComponentUpdateService() {}

OmniboxTriggeredFeatureService*
ChromeAutocompleteProviderClient::GetOmniboxTriggeredFeatureService() const {}

signin::IdentityManager* ChromeAutocompleteProviderClient::GetIdentityManager()
    const {}

AutocompleteScoringModelService*
ChromeAutocompleteProviderClient::GetAutocompleteScoringModelService() const {}

OnDeviceTailModelService*
ChromeAutocompleteProviderClient::GetOnDeviceTailModelService() const {}

ProviderStateService*
ChromeAutocompleteProviderClient::GetProviderStateService() const {}

bool ChromeAutocompleteProviderClient::IsOffTheRecord() const {}

bool ChromeAutocompleteProviderClient::IsIncognitoProfile() const {}

bool ChromeAutocompleteProviderClient::IsGuestSession() const {}

bool ChromeAutocompleteProviderClient::SearchSuggestEnabled() const {}

bool ChromeAutocompleteProviderClient::AllowDeletingBrowserHistory() const {}

bool ChromeAutocompleteProviderClient::IsPersonalizedUrlDataCollectionActive()
    const {}

bool ChromeAutocompleteProviderClient::IsAuthenticated() const {}

bool ChromeAutocompleteProviderClient::IsSyncActive() const {}

std::string ChromeAutocompleteProviderClient::ProfileUserName() const {}

void ChromeAutocompleteProviderClient::Classify(
    const std::u16string& text,
    bool prefer_keyword,
    bool allow_exact_keyword_match,
    metrics::OmniboxEventProto::PageClassification page_classification,
    AutocompleteMatch* match,
    GURL* alternate_nav_url) {}

void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory(
    history::KeywordID keyword_id,
    const std::u16string& term) {}

void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) {}

void ChromeAutocompleteProviderClient::StartServiceWorker(
    const GURL& destination_url) {}

const TabMatcher& ChromeAutocompleteProviderClient::GetTabMatcher() const {}

bool ChromeAutocompleteProviderClient::IsIncognitoModeAvailable() const {}

bool ChromeAutocompleteProviderClient::IsSharingHubAvailable() const {}

bool ChromeAutocompleteProviderClient::IsHistoryEmbeddingsEnabled() const {}

bool ChromeAutocompleteProviderClient::IsHistoryEmbeddingsSettingVisible()
    const {}

base::WeakPtr<AutocompleteProviderClient>
ChromeAutocompleteProviderClient::GetWeakPtr() {}

bool ChromeAutocompleteProviderClient::StrippedURLsAreEqual(
    const GURL& url1,
    const GURL& url2,
    const AutocompleteInput* input) const {}

void ChromeAutocompleteProviderClient::OpenSharingHub() {}

void ChromeAutocompleteProviderClient::NewIncognitoWindow() {}

void ChromeAutocompleteProviderClient::OpenIncognitoClearBrowsingDataDialog() {}

void ChromeAutocompleteProviderClient::CloseIncognitoWindows() {}

bool ChromeAutocompleteProviderClient::OpenJourneys(const std::string& query) {}

void ChromeAutocompleteProviderClient::PromptPageTranslation() {}