#include "chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h"
#include "base/command_line.h"
#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/connectors_service.h"
#include "chrome/browser/enterprise/util/affiliation.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/dm_token_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "components/policy/core/common/cloud/dm_token.h"
#include "components/policy/core/common/management/management_service.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/content/browser/web_ui/safe_browsing_ui.h"
#include "components/safe_browsing/core/browser/realtime/policy_engine.h"
#include "components/safe_browsing/core/browser/realtime/url_lookup_service_base.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/browser/sync/sync_utils.h"
#include "components/safe_browsing/core/browser/verdict_cache_manager.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/proto/realtimeapi.pb.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "url/gurl.h"
namespace safe_browsing {
namespace {
constexpr char kUrlFilteringEndpointFlag[] = …;
std::optional<GURL> GetUrlOverride() { … }
}
ChromeEnterpriseRealTimeUrlLookupService::
ChromeEnterpriseRealTimeUrlLookupService(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
VerdictCacheManager* cache_manager,
Profile* profile,
base::RepeatingCallback<ChromeUserPopulation()>
get_user_population_callback,
std::unique_ptr<SafeBrowsingTokenFetcher> token_fetcher,
enterprise_connectors::ConnectorsService* connectors_service,
ReferrerChainProvider* referrer_chain_provider)
: … { … }
ChromeEnterpriseRealTimeUrlLookupService::
~ChromeEnterpriseRealTimeUrlLookupService() = default;
bool ChromeEnterpriseRealTimeUrlLookupService::CanPerformFullURLLookup() const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::
CanPerformFullURLLookupWithToken() const { … }
int ChromeEnterpriseRealTimeUrlLookupService::GetReferrerUserGestureLimit()
const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::CanSendPageLoadToken() const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::
CanIncludeSubframeUrlInReferrerChain() const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::CanCheckSafeBrowsingDb() const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::
CanCheckSafeBrowsingHighConfidenceAllowlist() const { … }
void ChromeEnterpriseRealTimeUrlLookupService::GetAccessToken(
const GURL& url,
RTLookupResponseCallback response_callback,
scoped_refptr<base::SequencedTaskRunner> callback_task_runner,
SessionID tab_id) { … }
void ChromeEnterpriseRealTimeUrlLookupService::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) { … }
std::optional<std::string>
ChromeEnterpriseRealTimeUrlLookupService::GetDMTokenString() const { … }
GURL ChromeEnterpriseRealTimeUrlLookupService::GetRealTimeLookupUrl() const { … }
net::NetworkTrafficAnnotationTag
ChromeEnterpriseRealTimeUrlLookupService::GetTrafficAnnotationTag() const { … }
std::string ChromeEnterpriseRealTimeUrlLookupService::GetMetricSuffix() const { … }
void ChromeEnterpriseRealTimeUrlLookupService::Shutdown() { … }
bool ChromeEnterpriseRealTimeUrlLookupService::ShouldIncludeCredentials()
const { … }
std::optional<base::Time> ChromeEnterpriseRealTimeUrlLookupService::
GetMinAllowedTimestampForReferrerChains() const { … }
bool ChromeEnterpriseRealTimeUrlLookupService::CanSendRTSampleRequest() const { … }
std::string ChromeEnterpriseRealTimeUrlLookupService::GetUserEmail() const { … }
std::string ChromeEnterpriseRealTimeUrlLookupService::GetBrowserDMTokenString()
const { … }
std::string ChromeEnterpriseRealTimeUrlLookupService::GetProfileDMTokenString()
const { … }
std::unique_ptr<enterprise_connectors::ClientMetadata>
ChromeEnterpriseRealTimeUrlLookupService::GetClientMetadata() const { … }
}