chromium/components/history/core/browser/web_history_service.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 "components/history/core/browser/web_history_service.h"

#include <memory>
#include <optional>
#include <utility>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/history/core/browser/web_history_service_observer.h"
#include "components/signin/public/identity_manager/access_token_info.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/sync/base/features.h"
#include "components/sync/base/sync_util.h"
#include "components/sync/protocol/history_status.pb.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.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"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/gurl.h"

namespace history {

namespace {

const char kHistoryOAuthScope[] =;

const char kHistoryQueryHistoryUrl[] =;

const char kHistoryDeleteHistoryUrl[] =;

const char kHistoryAudioHistoryUrl[] =;

const char kHistoryAudioHistoryChangeUrl[] =;

const char kQueryWebAndAppActivityUrl[] =;

const char kQueryOtherFormsOfBrowsingHistoryUrlSuffix[] =;

const char kPostDataMimeType[] =;

const char kSyncProtoMimeType[] =;

// The maximum number of retries for the SimpleURLLoader requests.
const size_t kMaxRetries =;

class RequestImpl : public WebHistoryService::Request {};

// Converts a time into a string for use as a parameter in a request to the
// history server.
std::string ServerTimeString(base::Time time) {}

// Returns a URL for querying the history server for a query specified by
// `options`. `version_info`, if not empty, should be a token that was received
// from the server in response to a write operation. It is used to help ensure
// read consistency after a write.
GURL GetQueryUrl(const std::u16string& text_query,
                 const QueryOptions& options,
                 const std::string& version_info) {}

// Creates a dictionary to hold the parameters for a deletion.
// `url` may be empty, indicating a time-range deletion.
base::Value::Dict CreateDeletion(const std::string& min_time,
                                 const std::string& max_time,
                                 const GURL& url) {}

}  // namespace

WebHistoryService::Request::Request() = default;

WebHistoryService::Request::~Request() = default;

WebHistoryService::WebHistoryService(
    signin::IdentityManager* identity_manager,
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
    :{}

WebHistoryService::~WebHistoryService() = default;

void WebHistoryService::AddObserver(WebHistoryServiceObserver* observer) {}

void WebHistoryService::RemoveObserver(WebHistoryServiceObserver* observer) {}

WebHistoryService::Request* WebHistoryService::CreateRequest(
    const GURL& url,
    CompletionCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

// static
std::optional<base::Value::Dict> WebHistoryService::ReadResponse(
    WebHistoryService::Request* request) {}

std::unique_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory(
    const std::u16string& text_query,
    const QueryOptions& options,
    WebHistoryService::QueryWebHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

void WebHistoryService::ExpireHistory(
    const std::vector<ExpireHistoryArgs>& expire_list,
    ExpireWebHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

void WebHistoryService::ExpireHistoryBetween(
    const std::set<GURL>& restrict_urls,
    base::Time begin_time,
    base::Time end_time,
    ExpireWebHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

void WebHistoryService::GetAudioHistoryEnabled(
    AudioWebHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

void WebHistoryService::SetAudioHistoryEnabled(
    bool new_enabled_value,
    AudioWebHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

size_t WebHistoryService::GetNumberOfPendingAudioHistoryRequests() {}

void WebHistoryService::QueryWebAndAppActivity(
    QueryWebAndAppActivityCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

void WebHistoryService::QueryOtherFormsOfBrowsingHistory(
    version_info::Channel channel,
    QueryOtherFormsOfBrowsingHistoryCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

// static
void WebHistoryService::QueryHistoryCompletionCallback(
    WebHistoryService::QueryWebHistoryCallback callback,
    WebHistoryService::Request* request,
    bool success) {}

void WebHistoryService::ExpireHistoryCompletionCallback(
    WebHistoryService::ExpireWebHistoryCallback callback,
    WebHistoryService::Request* request,
    bool success) {}

void WebHistoryService::AudioHistoryCompletionCallback(
    WebHistoryService::AudioWebHistoryCallback callback,
    WebHistoryService::Request* request,
    bool success) {}

void WebHistoryService::QueryWebAndAppActivityCompletionCallback(
    WebHistoryService::QueryWebAndAppActivityCallback callback,
    WebHistoryService::Request* request,
    bool success) {}

void WebHistoryService::QueryOtherFormsOfBrowsingHistoryCompletionCallback(
    WebHistoryService::QueryOtherFormsOfBrowsingHistoryCallback callback,
    WebHistoryService::Request* request,
    bool success) {}

}  // namespace history