chromium/components/search/start_suggest_service.cc

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

#include "components/search/start_suggest_service.h"

#include <algorithm>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
#include "components/omnibox/browser/autocomplete_scheme_classifier.h"
#include "components/omnibox/browser/search_suggestion_parser.h"
#include "components/search/search_provider_observer.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"

namespace {
// A cache of trending query suggestions using JSON serialized into a string.
const char kTrendingQuerySuggestionCachedResults[] =;

const char kXSSIResponsePreamble[] =;
}  // namespace

StartSuggestService::StartSuggestService(
    TemplateURLService* template_url_service,
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier,
    const std::string& application_country,
    const std::string& application_locale,
    const GURL& request_initiator_url)
    :{}

StartSuggestService::~StartSuggestService() = default;

void StartSuggestService::FetchSuggestions(
    const TemplateURLRef::SearchTermsArgs& args,
    SuggestResultCallback callback,
    bool fetch_from_server) {}

void StartSuggestService::SearchProviderChanged() {}

GURL StartSuggestService::GetRequestURL(
    const TemplateURLRef::SearchTermsArgs& search_terms_args) {}

GURL StartSuggestService::GetQueryDestinationURL(
    const std::u16string& query,
    const TemplateURL* search_provider) {}

SearchProviderObserver* StartSuggestService::search_provider_observer() {}

void StartSuggestService::SuggestResponseLoaded(
    network::SimpleURLLoader* loader,
    SuggestResultCallback callback,
    std::unique_ptr<std::string> response) {}

void StartSuggestService::SuggestionsParsed(
    SuggestResultCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}