chromium/components/safe_browsing/core/browser/realtime/url_lookup_service.cc

// Copyright 2019 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/safe_browsing/core/browser/realtime/url_lookup_service.h"

#include "base/base64url.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "components/safe_browsing/core/browser/realtime/policy_engine.h"
#include "components/safe_browsing/core/browser/referrer_chain_provider.h"
#include "components/safe_browsing/core/browser/safe_browsing_token_fetcher.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/unified_consent/pref_names.h"
#include "net/base/ip_address.h"
#include "net/base/load_flags.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"

namespace {

constexpr int kDefaultRealTimeUrlLookupReferrerLength =;

// Probability for sending protego requests for urls on the allowlist
const float kProbabilityForSendingSampledRequests =;

constexpr char kCookieHistogramPrefix[] =;

}  // namespace

namespace safe_browsing {

RealTimeUrlLookupService::RealTimeUrlLookupService(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    VerdictCacheManager* cache_manager,
    base::RepeatingCallback<ChromeUserPopulation()>
        get_user_population_callback,
    PrefService* pref_service,
    std::unique_ptr<SafeBrowsingTokenFetcher> token_fetcher,
    const ClientConfiguredForTokenFetchesCallback& client_token_config_callback,
    bool is_off_the_record,
    variations::VariationsService* variations_service,
    ReferrerChainProvider* referrer_chain_provider,
    WebUIDelegate* delegate)
    :{}

void RealTimeUrlLookupService::GetAccessToken(
    const GURL& url,
    RTLookupResponseCallback response_callback,
    scoped_refptr<base::SequencedTaskRunner> callback_task_runner,
    SessionID tab_id) {}

void RealTimeUrlLookupService::OnPrefChanged() {}

void RealTimeUrlLookupService::OnGetAccessToken(
    const GURL& url,
    RTLookupResponseCallback response_callback,
    scoped_refptr<base::SequencedTaskRunner> callback_task_runner,
    base::TimeTicks get_token_start_time,
    SessionID tab_id,
    const std::string& access_token) {}

void RealTimeUrlLookupService::OnResponseUnauthorized(
    const std::string& invalid_access_token) {}

RealTimeUrlLookupService::~RealTimeUrlLookupService() = default;

bool RealTimeUrlLookupService::CanPerformFullURLLookup() const {}

bool RealTimeUrlLookupService::CanPerformFullURLLookupWithToken() const {}

int RealTimeUrlLookupService::GetReferrerUserGestureLimit() const {}

bool RealTimeUrlLookupService::CanSendPageLoadToken() const {}

bool RealTimeUrlLookupService::CanIncludeSubframeUrlInReferrerChain() const {}

bool RealTimeUrlLookupService::CanCheckSafeBrowsingDb() const {}

bool RealTimeUrlLookupService::CanCheckSafeBrowsingHighConfidenceAllowlist()
    const {}

bool RealTimeUrlLookupService::CanSendRTSampleRequest() const {}

std::string RealTimeUrlLookupService::GetUserEmail() const {}

std::string RealTimeUrlLookupService::GetBrowserDMTokenString() const {}

std::string RealTimeUrlLookupService::GetProfileDMTokenString() const {}

std::unique_ptr<enterprise_connectors::ClientMetadata>
RealTimeUrlLookupService::GetClientMetadata() const {}

void RealTimeUrlLookupService::Shutdown() {}

GURL RealTimeUrlLookupService::GetRealTimeLookupUrl() const {}

net::NetworkTrafficAnnotationTag
RealTimeUrlLookupService::GetTrafficAnnotationTag() const {}

std::optional<std::string> RealTimeUrlLookupService::GetDMTokenString() const {}

std::string RealTimeUrlLookupService::GetMetricSuffix() const {}

bool RealTimeUrlLookupService::ShouldIncludeCredentials() const {}

std::optional<base::Time>
RealTimeUrlLookupService::GetMinAllowedTimestampForReferrerChains() const {}

void RealTimeUrlLookupService::MaybeLogLastProtegoPingTimeToPrefs(
    bool sent_with_token) {}

void RealTimeUrlLookupService::MaybeLogProtegoPingCookieHistograms(
    bool request_had_cookie,
    bool was_first_request,
    bool sent_with_token) {}

}  // namespace safe_browsing