#include "components/omnibox/browser/document_suggestions_service.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/json/json_writer.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/omnibox/browser/document_provider.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/primary_account_access_token_fetcher.h"
#include "components/signin/public/identity_manager/scope_set.h"
#include "components/variations/net/variations_http_headers.h"
#include "google_apis/gaia/gaia_constants.h"
#include "net/base/load_flags.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 {
constexpr int chromeOmniboxClientId = …;
std::string BuildDocumentSuggestionRequest(const std::u16string& query) { … }
}
DocumentSuggestionsService::DocumentSuggestionsService(
signin::IdentityManager* identity_manager,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
DocumentSuggestionsService::~DocumentSuggestionsService() { … }
void DocumentSuggestionsService::CreateDocumentSuggestionsRequest(
const std::u16string& query,
bool is_incognito,
CreationCallback creation_callback,
StartCallback start_callback,
CompletionCallback completion_callback) { … }
void DocumentSuggestionsService::StopCreatingDocumentSuggestionsRequest() { … }
void DocumentSuggestionsService::AccessTokenAvailable(
std::unique_ptr<network::ResourceRequest> request,
std::string request_body,
net::NetworkTrafficAnnotationTag traffic_annotation,
StartCallback start_callback,
CompletionCallback completion_callback,
GoogleServiceAuthError error,
signin::AccessTokenInfo access_token_info) { … }
void DocumentSuggestionsService::StartDownloadAndTransferLoader(
std::unique_ptr<network::ResourceRequest> request,
std::string request_body,
net::NetworkTrafficAnnotationTag traffic_annotation,
StartCallback start_callback,
CompletionCallback completion_callback) { … }