0

Rename dips namespace to btm

This CL also does some trivial refactoring (i.e. variable and comment
renaming) in already-touched files.

Change-Id: Id6a40ec0121b9808599d9c95e550f47ba8600eb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6314373
Commit-Queue: Andrew Liu <liu@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Ryan Tarpine <rtarpine@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427146}
This commit is contained in:
Andrew Liu
2025-03-03 08:20:11 -08:00
committed by Chromium LUCI CQ
parent 43d0d702ca
commit 37d1ddcf53
13 changed files with 230 additions and 231 deletions

@ -10,7 +10,7 @@
#include "content/public/browser/btm_service.h"
#include "content/public/browser/web_contents_user_data.h"
namespace dips {
namespace btm {
StatefulBounceCounter::StatefulBounceCounter(PassKey,
content::BtmService* dips_service)
@ -40,4 +40,4 @@ void StatefulBounceCounter::OnStatefulBounce(
const int StatefulBounceCounter::kUserDataKey;
} // namespace dips
} // namespace btm

@ -10,7 +10,7 @@
#include "base/types/pass_key.h"
#include "content/public/browser/btm_service.h"
namespace dips {
namespace btm {
// This class exists just to call
// PageSpecificContentSettings::IncrementStatefulBounceCount() whenever the user
@ -38,6 +38,6 @@ class StatefulBounceCounter : public content::BtmService::Observer,
static const int kUserDataKey = 0;
};
} // namespace dips
} // namespace btm
#endif // CHROME_BROWSER_BTM_STATEFUL_BOUNCE_COUNTER_H_

@ -8625,10 +8625,10 @@ bool ShouldBrowserContextEnableDips(content::BrowserContext* browser_context) {
void ChromeContentBrowserClient::OnDipsServiceCreated(
content::BrowserContext* browser_context,
content::BtmService* dips_service) {
content::BtmService* btm_service) {
// Create BtmBrowserSigninDetector.
CHECK(BtmBrowserSigninDetector::Get(browser_context));
dips::StatefulBounceCounter::CreateFor(dips_service);
btm::StatefulBounceCounter::CreateFor(btm_service);
}
static_assert(content::ContentBrowserClient::kDefaultDipsRemoveMask ==

@ -106,19 +106,19 @@ PAGE_USER_DATA_KEY_IMPL(PrimaryPageMarker);
/* static */
void BtmWebContentsObserver::MaybeCreateForWebContents(
WebContents* web_contents) {
auto* dips_service = BtmServiceImpl::Get(web_contents->GetBrowserContext());
if (!dips_service) {
auto* btm_service = BtmServiceImpl::Get(web_contents->GetBrowserContext());
if (!btm_service) {
return;
}
BtmWebContentsObserver::CreateForWebContents(web_contents, dips_service);
BtmWebContentsObserver::CreateForWebContents(web_contents, btm_service);
}
BtmWebContentsObserver::BtmWebContentsObserver(WebContents* web_contents,
BtmServiceImpl* dips_service)
BtmServiceImpl* btm_service)
: WebContentsObserver(web_contents),
WebContentsUserData<BtmWebContentsObserver>(*web_contents),
dips_service_(dips_service) {
btm_service_(btm_service) {
detector_ = RedirectChainDetector::FromWebContents(web_contents);
CHECK(detector_);
detector_->AddObserver(this);
@ -432,7 +432,7 @@ void BtmRedirectContext::TrimAndHandleRedirects(size_t trim_count) {
DCHECK_GE(redirects_.size(), trim_count);
// Use an empty final_URL. This processes the redirect as different from the
// final URL, which allows recording in the DIPS database.
// final URL, which allows recording in the BTM database.
auto chain = std::make_unique<BtmRedirectChainInfo>(
initial_url_,
/*final_url=*/UrlAndSourceId(), GetRedirectChainLength(),
@ -526,7 +526,7 @@ void RedirectChainDetector::ReportRedirectors(std::set<std::string> sites) {
void BtmWebContentsObserver::ReportRedirectors(
const std::set<std::string>& sites) {
dips_service_->storage()
btm_service_->storage()
->AsyncCall(&BtmStorage::FilterSitesWithoutProtectiveEvent)
.WithArgs(sites)
.Then(issue_reporting_callback_);
@ -537,21 +537,21 @@ void BtmWebContentsObserver::RecordEvent(BtmRecordedEvent event,
const base::Time& time) {
switch (event) {
case BtmRecordedEvent::kStorage: {
dips_service_->storage()
btm_service_->storage()
->AsyncCall(&BtmStorage::RecordStorage)
.WithArgs(url, time, dips_service_->GetCookieMode());
.WithArgs(url, time, btm_service_->GetCookieMode());
return;
}
case BtmRecordedEvent::kUserActivation: {
dips_service_->storage()
btm_service_->storage()
->AsyncCall(&BtmStorage::RecordUserActivation)
.WithArgs(url, time, dips_service_->GetCookieMode());
.WithArgs(url, time, btm_service_->GetCookieMode());
return;
}
case BtmRecordedEvent::kWebAuthnAssertion: {
dips_service_->storage()
btm_service_->storage()
->AsyncCall(&BtmStorage::RecordWebAuthnAssertion)
.WithArgs(url, time, dips_service_->GetCookieMode());
.WithArgs(url, time, btm_service_->GetCookieMode());
return;
}
}
@ -568,7 +568,7 @@ UrlAndSourceId RedirectChainDetector::GetLastCommittedURL() const {
->GetPageUkmSourceId());
}
namespace dips {
namespace btm {
void Populate3PcExceptions(BrowserContext* browser_context,
WebContents* web_contents,
const GURL& initial_url,
@ -588,16 +588,16 @@ void Populate3PcExceptions(BrowserContext* browser_context,
browser_context, web_contents, redirect->url.url, final_url_key);
}
}
} // namespace dips
} // namespace btm
void RedirectChainDetector::HandleRedirectChain(
std::vector<BtmRedirectInfoPtr> redirects,
BtmRedirectChainInfoPtr chain) {
// We have to set `has_3pc_exception` on each redirect before passing them to
// the BtmService, because calculating it depends on the WebContents.
dips::Populate3PcExceptions(web_contents()->GetBrowserContext(),
web_contents(), chain->initial_url.url,
chain->final_url.url, redirects);
btm::Populate3PcExceptions(web_contents()->GetBrowserContext(),
web_contents(), chain->initial_url.url,
chain->final_url.url, redirects);
delayed_handler_.HandleRedirectChain(std::move(redirects), std::move(chain));
}
@ -614,7 +614,7 @@ void BtmWebContentsObserver::OnRedirectChainEnded(
const BtmRedirectChainInfo& chain) {
// We need to pass in a WeakPtr to BtmWebContentsObserver as it's not
// guaranteed to outlive the call.
dips_service_->HandleRedirectChain(
btm_service_->HandleRedirectChain(
CloneRedirects(redirects), std::make_unique<BtmRedirectChainInfo>(chain),
base::BindRepeating(&BtmWebContentsObserver::OnStatefulBounce,
weak_factory_.GetWeakPtr()));
@ -628,7 +628,7 @@ void BtmWebContentsObserver::OnStatefulBounce(const GURL& final_url) {
return;
}
dips_service_->NotifyStatefulBounce(web_contents());
btm_service_->NotifyStatefulBounce(web_contents());
}
// A thin wrapper around NavigationHandle to implement BtmNavigationHandle.
@ -687,8 +687,8 @@ void RedirectChainDetector::DidStartNavigation(
return;
}
BtmNavigationHandleImpl dips_handle(navigation_handle);
detector_.DidStartNavigation(&dips_handle);
BtmNavigationHandleImpl btm_handle(navigation_handle);
detector_.DidStartNavigation(&btm_handle);
}
void BtmBounceDetector::DidStartNavigation(
@ -750,8 +750,8 @@ void RedirectChainDetector::DidRedirectNavigation(
return;
}
BtmNavigationHandleImpl dips_handle(navigation_handle);
detector_.DidRedirectNavigation(&dips_handle);
BtmNavigationHandleImpl btm_handle(navigation_handle);
detector_.DidRedirectNavigation(&btm_handle);
}
void BtmBounceDetector::DidRedirectNavigation(
@ -791,14 +791,14 @@ void RedirectChainDetector::PrimaryPageChanged(Page& page) {
PrimaryPageMarker::CreateForPage(page);
}
namespace dips {
namespace btm {
bool IsOrWasInPrimaryPage(RenderFrameHost* render_frame_host) {
return IsInPrimaryPage(render_frame_host) ||
PrimaryPageMarker::GetForPage(render_frame_host->GetPage());
}
} // namespace dips
} // namespace btm
void RedirectChainDetector::OnCookiesAccessed(
RenderFrameHost* render_frame_host,
@ -807,7 +807,7 @@ void RedirectChainDetector::OnCookiesAccessed(
// - From other page types like FencedFrames and Prerendered.
// - Blocked by policies.
if (details.blocked_by_policy ||
!dips::IsOrWasInPrimaryPage(render_frame_host)) {
!btm::IsOrWasInPrimaryPage(render_frame_host)) {
return;
}
@ -878,8 +878,8 @@ void RedirectChainDetector::OnCookiesAccessed(
return;
}
BtmNavigationHandleImpl dips_handle(navigation_handle);
detector_.OnServerCookiesAccessed(&dips_handle, details.url, details.type);
BtmNavigationHandleImpl btm_handle(navigation_handle);
detector_.OnServerCookiesAccessed(&btm_handle, details.url, details.type);
}
void BtmBounceDetector::OnClientSiteDataAccessed(const GURL& url,
@ -1004,10 +1004,10 @@ void BtmWebContentsObserver::OnWorkerCreated(
void BtmWebContentsObserver::PrimaryPageChanged(Page& page) {
if (last_committed_site_.has_value()) {
dips_service_->RemoveOpenSite(last_committed_site_.value());
btm_service_->RemoveOpenSite(last_committed_site_.value());
}
last_committed_site_ = GetSiteForBtm(web_contents()->GetLastCommittedURL());
dips_service_->AddOpenSite(last_committed_site_.value());
btm_service_->AddOpenSite(last_committed_site_.value());
last_storage_timestamp_.reset();
last_interaction_timestamp_.reset();
@ -1020,8 +1020,8 @@ void RedirectChainDetector::DidFinishNavigation(
return;
}
BtmNavigationHandleImpl dips_handle(navigation_handle);
detector_.DidFinishNavigation(&dips_handle);
BtmNavigationHandleImpl btm_handle(navigation_handle);
detector_.DidFinishNavigation(&btm_handle);
if (navigation_handle->HasCommitted()) {
for (auto& observer : observers_) {
@ -1219,7 +1219,7 @@ void BtmWebContentsObserver::WebAuthnAssertionRequestSucceeded(
void BtmWebContentsObserver::WebContentsDestroyed() {
if (last_committed_site_.has_value()) {
dips_service_->RemoveOpenSite(last_committed_site_.value());
btm_service_->RemoveOpenSite(last_committed_site_.value());
}
detector_ = nullptr; // was observing the same WebContents.
}
@ -1247,7 +1247,7 @@ void BtmBounceDetector::OnClientBounceDetectionTimeout() {
WEB_CONTENTS_USER_DATA_KEY_IMPL(RedirectChainDetector);
WEB_CONTENTS_USER_DATA_KEY_IMPL(BtmWebContentsObserver);
namespace dips {
namespace btm {
ukm::SourceId GetRedirectSourceId(NavigationHandle* navigation_handle,
size_t index) {
@ -1255,7 +1255,7 @@ ukm::SourceId GetRedirectSourceId(NavigationHandle* navigation_handle,
return handle.GetRedirectSourceId(index);
}
} // namespace dips
} // namespace btm
void RedirectChainDetector::AddObserver(Observer* observer) {
observers_.AddObserver(observer);

@ -489,8 +489,8 @@ class CONTENT_EXPORT BtmWebContentsObserver
// TODO(rtarpine): make this take a Clock&.
void SetClockForTesting(base::Clock* clock) {
DCHECK(dips_service_);
dips_service_->storage()
DCHECK(btm_service_);
btm_service_->storage()
->AsyncCall(&BtmStorage::SetClockForTesting)
.WithArgs(clock);
RedirectChainDetector::FromWebContents(web_contents())
@ -565,7 +565,7 @@ class CONTENT_EXPORT BtmWebContentsObserver
// raw_ptr<> is safe here because BtmServiceImpl is a KeyedService,
// associated with the BrowserContext/Profile which will outlive the
// WebContents that BtmWebContentsObserver is observing.
raw_ptr<BtmServiceImpl> dips_service_;
raw_ptr<BtmServiceImpl> btm_service_;
raw_ref<base::Clock> clock_{*base::DefaultClock::GetInstance()};
BtmIssueReportingCallback issue_reporting_callback_;
@ -578,7 +578,7 @@ class CONTENT_EXPORT BtmWebContentsObserver
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
namespace dips {
namespace btm {
ukm::SourceId GetRedirectSourceId(NavigationHandle* navigation_handle,
size_t index);
@ -593,7 +593,7 @@ CONTENT_EXPORT void Populate3PcExceptions(
const GURL& final_url,
base::span<BtmRedirectInfoPtr> redirects);
} // namespace dips
} // namespace btm
} // namespace content

@ -169,7 +169,7 @@ bool ContainsWrite(BtmDataAccessType access) {
return access == kWrite || access == kReadWrite;
}
// Waits for DIPS to know that a cookie was written by a redirect at
// Waits for BTM to know that a cookie was written by a redirect at
// `redirect_url`, which must be the last redirect that was performed in the
// currenly-in-progress redirect chain.
testing::AssertionResult WaitForRedirectCookieWrite(WebContents* web_contents,
@ -444,11 +444,11 @@ class BtmBounceDetectorBrowserTest : public ContentBrowserTest {
// are never notified). Such tests should pass `wait`=false.
void EndRedirectChain(bool wait = true) {
WebContents* web_contents = GetActiveWebContents();
BtmService* dips_service =
BtmService* btm_service =
BtmService::Get(web_contents->GetBrowserContext());
GURL expected_url = web_contents->GetLastCommittedURL();
DipsRedirectChainObserver chain_observer(dips_service, expected_url);
DipsRedirectChainObserver chain_observer(btm_service, expected_url);
// Performing a browser-based navigation terminates the current redirect
// chain.
ASSERT_TRUE(NavigateToURL(
@ -2833,7 +2833,7 @@ class BtmBounceTriggerBrowserTest : public BtmBounceDetectorBrowserTest {
void SetUpOnMainThread() override {
BtmBounceDetectorBrowserTest::SetUpOnMainThread();
// DIPS will only record bounces if 3PCs are blocked.
// BTM will only record bounces if 3PCs are blocked.
browser_client().SetBlockThirdPartyCookiesByDefault(true);
}
};
@ -2877,7 +2877,7 @@ IN_PROC_BROWSER_TEST_F(BtmThrottlingBrowserTest,
const GURL url = embedded_test_server()->GetURL("a.test", "/title1.html");
ASSERT_TRUE(NavigateToURL(web_contents, url));
SimulateMouseClick();
// Verify the interaction was recorded in the DIPS DB.
// Verify the interaction was recorded in the BTM DB.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), url);
ASSERT_THAT(state->user_activation_times,
@ -2911,7 +2911,7 @@ IN_PROC_BROWSER_TEST_F(BtmThrottlingBrowserTest,
const GURL url = embedded_test_server()->GetURL("a.test", "/title1.html");
ASSERT_TRUE(NavigateToURL(web_contents, url));
SimulateMouseClick();
// Verify the interaction was recorded in the DIPS DB.
// Verify the interaction was recorded in the BTM DB.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), url);
ASSERT_THAT(state->user_activation_times,
@ -2939,7 +2939,7 @@ IN_PROC_BROWSER_TEST_F(BtmThrottlingBrowserTest,
const GURL url = embedded_test_server()->GetURL("a.test", "/title1.html");
ASSERT_TRUE(NavigateToURL(web_contents, url));
SimulateCookieWrite();
// Verify the write was recorded in the DIPS DB.
// Verify the write was recorded in the BTM DB.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), url);
ASSERT_THAT(state->site_storage_times,
@ -2974,7 +2974,7 @@ IN_PROC_BROWSER_TEST_F(BtmThrottlingBrowserTest,
const GURL url = embedded_test_server()->GetURL("a.test", "/title1.html");
ASSERT_TRUE(NavigateToURL(web_contents, url));
SimulateCookieWrite();
// Verify the write was recorded in the DIPS DB.
// Verify the write was recorded in the BTM DB.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), url);
ASSERT_THAT(state->site_storage_times,
@ -3101,10 +3101,10 @@ class BtmPrivacySandboxApiInteractionTest : public ContentBrowserTest {
void EndRedirectChain() {
WebContents* web_contents = GetActiveWebContents();
BtmService* dips_service = GetDipsService(web_contents);
BtmService* btm_service = GetDipsService(web_contents);
GURL expected_url = web_contents->GetLastCommittedURL();
DipsRedirectChainObserver chain_observer(dips_service, expected_url);
DipsRedirectChainObserver chain_observer(btm_service, expected_url);
// Performing a browser-based navigation terminates the current redirect
// chain.
ASSERT_TRUE(NavigateToURL(
@ -3256,7 +3256,7 @@ class BtmPrivacySandboxApiInteractionTest : public ContentBrowserTest {
};
// Verify that accessing storage via the PAT Protected Audience API doesn't
// trigger DIPS deletion for the accessing site.
// trigger BTM deletion for the accessing site.
IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
DontTriggerDeletionOnProtectedAudienceApiStorageAccess) {
WebContents* web_contents = GetActiveWebContents();
@ -3265,7 +3265,7 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
const char* pat_using_host = "pat.b.test";
// Write a secure cookie for PAT-using site, to represent site data written
// through non-DIPS-triggering means.
// through non-BTM-triggering means.
ASSERT_TRUE(NavigateToSetCookie(web_contents, &embedded_https_test_server_,
pat_using_host, true, false));
@ -3313,22 +3313,22 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
bounce_back_url));
EndRedirectChain();
// Expect DIPS to not have recorded user activation.
// Expect BTM to not have recorded user activation.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), bounce_url);
ASSERT_TRUE(state.has_value());
EXPECT_EQ(state->user_activation_times, std::nullopt);
// Expect DIPS to have classified the bounce to the PAT-using site as
// Expect BTM to have classified the bounce to the PAT-using site as
// stateless (i.e., to have recorded a bounce, but no stateful bounce).
EXPECT_EQ(state->stateful_bounce_times, std::nullopt);
EXPECT_TRUE(state->bounce_times.has_value());
// Trigger DIPS deletion, and expect DIPS to not have deleted data for the
// Trigger BTM deletion, and expect BTM to not have deleted data for the
// PAT-using site.
BtmService* dips = GetDipsService(web_contents);
BtmService* btm_service = GetDipsService(web_contents);
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
dips->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
btm_service->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
EXPECT_THAT(deleted_sites.Get(), IsEmpty());
// Make sure that the cookie we wrote for the PAT-using site is still there.
@ -3337,7 +3337,7 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
}
// Verify that accessing storage via the PAT Attribution Reporting API doesn't
// trigger DIPS deletion for the accessing site.
// trigger BTM deletion for the accessing site.
IN_PROC_BROWSER_TEST_F(
BtmPrivacySandboxApiInteractionTest,
DontTriggerDeletionOnAttributionReportingApiStorageAccess) {
@ -3348,7 +3348,7 @@ IN_PROC_BROWSER_TEST_F(
const char* attribution_host = "attribution.c.test";
// Write a secure cookie for PAT-using site, to represent site data written
// through non-DIPS-triggering means.
// through non-BTM-triggering means.
ASSERT_TRUE(NavigateToSetCookie(web_contents, &embedded_https_test_server_,
pat_using_host, true, false));
@ -3388,22 +3388,22 @@ IN_PROC_BROWSER_TEST_F(
bounce_back_url));
EndRedirectChain();
// Expect DIPS to not have recorded user activation.
// Expect BTM to not have recorded user activation.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), bounce_url);
ASSERT_TRUE(state.has_value());
EXPECT_EQ(state->user_activation_times, std::nullopt);
// Expect DIPS to have classified the bounce to the PAT-using site as
// Expect BTM to have classified the bounce to the PAT-using site as
// stateless (= to have recorded a bounce but no stateful bounce).
EXPECT_EQ(state->stateful_bounce_times, std::nullopt);
EXPECT_TRUE(state->bounce_times.has_value());
// Trigger DIPS deletion, and expect DIPS to not have deleted data for the
// Trigger BTM deletion, and expect BTM to not have deleted data for the
// PAT-using site.
BtmService* dips = GetDipsService(web_contents);
BtmService* btm_service = GetDipsService(web_contents);
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
dips->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
btm_service->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
EXPECT_THAT(deleted_sites.Get(), IsEmpty());
// Make sure that the cookie we wrote for the PAT-using site is still there.
@ -3412,7 +3412,7 @@ IN_PROC_BROWSER_TEST_F(
}
// Verify that accessing storage via the PAT Private State Tokens API doesn't
// trigger DIPS deletion for the accessing site.
// trigger BTM deletion for the accessing site.
IN_PROC_BROWSER_TEST_F(
BtmPrivacySandboxApiInteractionTest,
DontTriggerDeletionOnPrivateStateTokensApiStorageAccess) {
@ -3423,7 +3423,7 @@ IN_PROC_BROWSER_TEST_F(
ProvideRequestHandlerKeyCommitmentsToNetworkService({pat_using_host});
// Write a secure cookie for PAT-using site, to represent site data written
// through non-DIPS-triggering means.
// through non-BTM-triggering means.
ASSERT_TRUE(NavigateToSetCookie(web_contents, &embedded_https_test_server_,
pat_using_host, true, false));
@ -3466,22 +3466,22 @@ IN_PROC_BROWSER_TEST_F(
bounce_back_url));
EndRedirectChain();
// Expect DIPS to not have recorded user activation.
// Expect BTM to not have recorded user activation.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), bounce_url);
ASSERT_TRUE(state.has_value());
EXPECT_EQ(state->user_activation_times, std::nullopt);
// Expect DIPS to have classified the bounce to the PAT-using site as
// Expect BTM to have classified the bounce to the PAT-using site as
// stateless (= to have recorded a bounce but no stateful bounce).
EXPECT_EQ(state->stateful_bounce_times, std::nullopt);
EXPECT_TRUE(state->bounce_times.has_value());
// Trigger DIPS deletion, and expect DIPS to not have deleted data for the
// Trigger BTM deletion, and expect BTM to not have deleted data for the
// PAT-using site.
BtmService* dips = GetDipsService(web_contents);
BtmService* btm_service = GetDipsService(web_contents);
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
dips->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
btm_service->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
EXPECT_THAT(deleted_sites.Get(), IsEmpty());
// Make sure that the cookie we wrote for the PAT-using site is still there.
@ -3489,7 +3489,7 @@ IN_PROC_BROWSER_TEST_F(
"name=value");
}
// Verify that accessing storage via the PAT Topics API doesn't trigger DIPS
// Verify that accessing storage via the PAT Topics API doesn't trigger BTM
// deletion for the accessing site.
IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
DontTriggerDeletionOnTopicsApiStorageAccess) {
@ -3499,7 +3499,7 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
const char* pat_using_host = "pat.b.test";
// Write a secure cookie for PAT-using site, to represent site data written
// through non-DIPS-triggering means.
// through non-BTM-triggering means.
ASSERT_TRUE(NavigateToSetCookie(web_contents, &embedded_https_test_server_,
pat_using_host, true, false));
@ -3531,22 +3531,22 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxApiInteractionTest,
bounce_back_url));
EndRedirectChain();
// Expect DIPS to not have recorded user activation.
// Expect BTM to not have recorded user activation.
std::optional<StateValue> state =
GetBtmState(GetDipsService(web_contents), bounce_url);
ASSERT_TRUE(state.has_value());
EXPECT_EQ(state->user_activation_times, std::nullopt);
// Expect DIPS to have classified the bounce to the PAT-using site as
// Expect BTM to have classified the bounce to the PAT-using site as
// stateless (= to have recorded a bounce but no stateful bounce).
EXPECT_EQ(state->stateful_bounce_times, std::nullopt);
EXPECT_TRUE(state->bounce_times.has_value());
// Trigger DIPS deletion, and expect DIPS to not have deleted data for the
// Trigger BTM deletion, and expect BTM to not have deleted data for the
// PAT-using site.
BtmService* dips = GetDipsService(web_contents);
BtmService* btm_service = GetDipsService(web_contents);
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
dips->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
btm_service->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
EXPECT_THAT(deleted_sites.Get(), IsEmpty());
// Make sure that the cookie we wrote for the PAT-using site is still there.
@ -3590,19 +3590,20 @@ IN_PROC_BROWSER_TEST_F(BtmPrivacySandboxDataPreservationTest,
ASSERT_THAT(GetOrigins(data),
ElementsAre(url::Origin::Create(attribution_url)));
// Make the attribution site eligible for DIPS deletion.
BtmServiceImpl* dips = BtmServiceImpl::Get(web_contents->GetBrowserContext());
ASSERT_TRUE(dips != nullptr);
// Make the attribution site eligible for BTM deletion.
BtmServiceImpl* btm_service =
BtmServiceImpl::Get(web_contents->GetBrowserContext());
ASSERT_TRUE(btm_service != nullptr);
base::test::TestFuture<void> record_bounce;
dips->storage()
btm_service->storage()
->AsyncCall(&BtmStorage::RecordBounce)
.WithArgs(attribution_url, base::Time::Now(), /*stateful=*/true)
.Then(record_bounce.GetCallback());
ASSERT_TRUE(record_bounce.Wait());
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
dips->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
btm_service->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
EXPECT_THAT(deleted_sites.Get(), ElementsAre(GetSiteForBtm(attribution_url)));
base::test::TestFuture<AttributionData> post_deletion_data;
@ -3845,11 +3846,11 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest, DeleteDomain) {
// Confirm unpartitioned storage was written on b.test.
EXPECT_THAT(ReadFromStorage("b.test"), base::test::ValueIs("bounce=yes"));
// Navigate away from b.test since DIPS won't delete its state while loaded.
// Navigate away from b.test since BTM won't delete its state while loaded.
ASSERT_TRUE(NavigateToURL(web_contents,
https_server().GetURL("a.test", "/title1.html")));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3870,7 +3871,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest, DontDeleteOtherDomains) {
// Perform a stateful bounce on b.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("a.test", "b.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3893,7 +3894,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest,
// Perform a stateful bounce on b.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("a.test", "b.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3915,7 +3916,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest, DeleteSubdomains) {
// Perform a stateful bounce on b.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("a.test", "b.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3937,7 +3938,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest, DeleteEmbedded3Ps) {
// Perform a stateful bounce on b.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("a.test", "b.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3961,7 +3962,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest,
// Perform a stateful bounce on b.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("a.test", "b.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -3984,7 +3985,7 @@ IN_PROC_BROWSER_TEST_P(BtmDataDeletionBrowserTest, DeleteEmbedded1Ps) {
// Perform a stateful bounce on a.test to make it eligible for deletion.
ASSERT_TRUE(DoStatefulBounce("b.test", "a.test", "c.test"));
// Trigger DIPS deletion.
// Trigger BTM deletion.
base::test::TestFuture<const std::vector<std::string>&> deleted_sites;
BtmService::Get(web_contents->GetBrowserContext())
->DeleteEligibleSitesImmediately(deleted_sites.GetCallback());
@ -4021,7 +4022,7 @@ class BtmBounceDetectorBFCacheTest : public BtmBounceDetectorBrowserTest,
}
};
// Confirm that DIPS records a bounce that writes a cookie as stateful, even if
// Confirm that BTM records a bounce that writes a cookie as stateful, even if
// the user immediately navigates away.
IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, LateCookieAccessTest) {
const GURL bounce_url =
@ -4062,10 +4063,10 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, LateCookieAccessTest) {
testing::AnyOf(BtmDataAccessType::kWrite, BtmDataAccessType::kReadWrite));
}
// Confirm that DIPS records a bounce that writes a cookie as stateful, even if
// Confirm that BTM records a bounce that writes a cookie as stateful, even if
// the chain ends immediately afterwards.
IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, QuickEndChainTest) {
// Block 3PCs so DIPS will record bounces.
// Block 3PCs so BTM will record bounces.
browser_client().SetBlockThirdPartyCookiesByDefault(true);
const GURL initial_url =
@ -4119,12 +4120,12 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, CookieAccessReported) {
"OnCookiesAccessed(RenderFrameHost, Change: a.test/empty.html)"));
}
// Confirm that DIPS records an interaction, even if the user immediately
// Confirm that BTM records an interaction, even if the user immediately
// navigates away.
//
// TODO: crbug.com/376625002 - After moving to //content, this test was flaky
// because the navigation to final_url unexpectedly sometimes has a user
// gesture. Because there's no indication of a fault in DIPS, we disabled this
// gesture. Because there's no indication of a fault in BTM, we disabled this
// test to get the move done, but we should try to fix and re-enable it.
IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
DISABLED_LateInteractionTest) {
@ -4151,7 +4152,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
// click is processed, causing open() to fail and leaving the window with
// transient user activation. In such a case, just skip the test. (If we
// used UserActivationObserver::Wait() here, it would defeat the purpose of
// this test, which is to verify that DIPS sees the interaction even if the
// this test, which is to verify that BTM sees the interaction even if the
// test doesn't wait for it.)
GTEST_SKIP();
}
@ -4180,7 +4181,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, IsOrWasInPrimaryPage) {
web_contents, embedded_test_server()->GetURL("a.test", "/empty.html")));
RenderFrameHost* rfh = web_contents->GetPrimaryMainFrame();
EXPECT_TRUE(IsInPrimaryPage(rfh));
EXPECT_TRUE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_TRUE(btm::IsOrWasInPrimaryPage(rfh));
const GlobalRenderFrameHostId rfh_id = rfh->GetGlobalId();
ASSERT_TRUE(NavigateToURL(
@ -4194,7 +4195,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, IsOrWasInPrimaryPage) {
RenderFrameHost::LifecycleState::kInBackForwardCache));
// The page is no longer primary, but it used to be:
EXPECT_FALSE(IsInPrimaryPage(rfh));
EXPECT_TRUE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_TRUE(btm::IsOrWasInPrimaryPage(rfh));
} else {
// If the bfcache is disabled, the RFH may or may not be in memory. If it
// still is, it's only because it's pending deletion.
@ -4203,7 +4204,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest, IsOrWasInPrimaryPage) {
RenderFrameHost::LifecycleState::kPendingDeletion));
// The page is no longer primary, but it used to be:
EXPECT_FALSE(IsInPrimaryPage(rfh));
EXPECT_TRUE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_TRUE(btm::IsOrWasInPrimaryPage(rfh));
}
}
}
@ -4261,7 +4262,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
RenderFrameHost* rfh = RenderFrameHost::FromID(observer.rfh_id());
ASSERT_TRUE(rfh);
EXPECT_FALSE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_FALSE(btm::IsOrWasInPrimaryPage(rfh));
// Navigating to another site may trigger destruction of the frame.
ASSERT_TRUE(NavigateToURL(
@ -4270,7 +4271,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
rfh = RenderFrameHost::FromID(observer.rfh_id());
if (rfh) {
// Even if it's still in memory, it was never primary.
EXPECT_FALSE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_FALSE(btm::IsOrWasInPrimaryPage(rfh));
}
}
@ -4299,7 +4300,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
RenderFrameHost* rfh = RenderFrameHost::FromID(observer.rfh_id());
ASSERT_TRUE(rfh);
EXPECT_FALSE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_FALSE(btm::IsOrWasInPrimaryPage(rfh));
// Navigate to the prerendered page.
ASSERT_TRUE(NavigateToURLFromRenderer(
@ -4312,7 +4313,7 @@ IN_PROC_BROWSER_TEST_P(BtmBounceDetectorBFCacheTest,
rfh = RenderFrameHost::FromID(observer.rfh_id());
if (rfh) {
EXPECT_FALSE(IsInPrimaryPage(rfh));
EXPECT_TRUE(dips::IsOrWasInPrimaryPage(rfh));
EXPECT_TRUE(btm::IsOrWasInPrimaryPage(rfh));
}
}

@ -40,17 +40,17 @@ bool IsPageTransitionDirectNavigation(ui::PageTransition page_transition) {
return false;
}
dips::DirectNavigationSource ToDirectNavigationSource(
btm::DirectNavigationSource ToDirectNavigationSource(
ui::PageTransition page_transition) {
if (ui::PageTransitionCoreTypeIs(page_transition,
ui::PAGE_TRANSITION_TYPED)) {
return dips::DirectNavigationSource::kOmnibar;
return btm::DirectNavigationSource::kOmnibar;
}
if (ui::PageTransitionCoreTypeIs(page_transition,
ui::PAGE_TRANSITION_AUTO_BOOKMARK)) {
return dips::DirectNavigationSource::kBookmark;
return btm::DirectNavigationSource::kBookmark;
}
return dips::DirectNavigationSource::kUnknown;
return btm::DirectNavigationSource::kUnknown;
}
// Looks for a redirect to the current page that qualifies as a server-redirect
@ -135,7 +135,7 @@ void MaybeEmitDirectNavigationUkm(NavigationHandle* navigation_handle,
}
} // namespace
namespace dips {
namespace btm {
PageVisitInfo::PageVisitInfo() {
site = "";
@ -160,7 +160,7 @@ bool PageVisitInfo::WasNavigationToPageClientRedirect() const {
}
EntrypointInfo::EntrypointInfo(const BtmRedirectInfo& server_redirect_info,
const dips::PageVisitInfo& exit_page_info)
const btm::PageVisitInfo& exit_page_info)
: site(server_redirect_info.site),
source_id(server_redirect_info.url.source_id),
had_triggering_storage_access(
@ -169,8 +169,7 @@ EntrypointInfo::EntrypointInfo(const BtmRedirectInfo& server_redirect_info,
was_referral_client_redirect(
exit_page_info.WasNavigationToPageClientRedirect()) {}
EntrypointInfo::EntrypointInfo(
const dips::PageVisitInfo& client_redirector_info)
EntrypointInfo::EntrypointInfo(const btm::PageVisitInfo& client_redirector_info)
: site(client_redirector_info.site),
source_id(client_redirector_info.source_id),
had_triggering_storage_access(
@ -180,7 +179,7 @@ EntrypointInfo::EntrypointInfo(
client_redirector_info.WasNavigationToPageClientRedirect()) {}
InFlowSuccessorInteractionState::InFlowSuccessorInteractionState(
dips::EntrypointInfo flow_entrypoint)
btm::EntrypointInfo flow_entrypoint)
: flow_entrypoint_(flow_entrypoint) {}
InFlowSuccessorInteractionState::~InFlowSuccessorInteractionState() = default;
@ -208,12 +207,12 @@ bool InFlowSuccessorInteractionState::IsAtSuccessor() const {
return flow_index_ > 0;
}
} // namespace dips
} // namespace btm
BtmNavigationFlowDetector::BtmNavigationFlowDetector(WebContents* web_contents)
: WebContentsObserver(web_contents),
WebContentsUserData<BtmNavigationFlowDetector>(*web_contents),
current_page_visit_info_(dips::PageVisitInfo()) {
current_page_visit_info_(btm::PageVisitInfo()) {
redirect_chain_observation_.Observe(
RedirectChainDetector::FromWebContents(web_contents));
}
@ -270,15 +269,15 @@ void BtmNavigationFlowDetector::OnNavigationCommitted(
bool did_start_new_flow = MaybeInitializeSuccessorInteractionTrackingState();
flow_status_ = FlowStatusAfterNavigation(did_start_new_flow);
if (flow_status_ == dips::FlowStatus::kOngoing && !did_start_new_flow) {
if (flow_status_ == btm::FlowStatus::kOngoing && !did_start_new_flow) {
successor_interaction_tracking_state_->IncrementFlowIndex(
redirect_context.GetServerRedirectsSinceLastPrimaryPageChange().size() +
1);
}
if (flow_status_ == dips::FlowStatus::kEnded) {
if (flow_status_ == btm::FlowStatus::kEnded) {
MaybeEmitInFlowSuccessorInteraction();
}
if (flow_status_ != dips::FlowStatus::kOngoing) {
if (flow_status_ != btm::FlowStatus::kOngoing) {
successor_interaction_tracking_state_.reset();
}
@ -367,7 +366,7 @@ bool BtmNavigationFlowDetector::
return false;
}
dips::EntrypointInfo entrypoint_info_for_server_redirect_exit(
btm::EntrypointInfo entrypoint_info_for_server_redirect_exit(
*exit_info, *current_page_visit_info_);
return CanEmitSuspectedTrackerFlowUkm(
*previous_page_visit_info_, entrypoint_info_for_server_redirect_exit,
@ -401,16 +400,16 @@ bool BtmNavigationFlowDetector::
return false;
}
dips::EntrypointInfo entrypoint_info(previous_page_visit_info_.value());
btm::EntrypointInfo entrypoint_info(previous_page_visit_info_.value());
return CanEmitSuspectedTrackerFlowUkm(two_pages_ago_visit_info_.value(),
entrypoint_info,
current_page_visit_info_.value());
}
bool BtmNavigationFlowDetector::CanEmitSuspectedTrackerFlowUkm(
const dips::PageVisitInfo& referrer_page_info,
const dips::EntrypointInfo& entrypoint_info,
const dips::PageVisitInfo& exit_page_info) const {
const btm::PageVisitInfo& referrer_page_info,
const btm::EntrypointInfo& entrypoint_info,
const btm::PageVisitInfo& exit_page_info) const {
bool referrer_has_valid_source_id =
referrer_page_info.source_id != ukm::kInvalidSourceId;
bool entrypoint_has_valid_source_id =
@ -458,13 +457,13 @@ void BtmNavigationFlowDetector::MaybeEmitInFlowSuccessorInteraction() {
}
}
dips::FlowStatus BtmNavigationFlowDetector::FlowStatusAfterNavigation(
btm::FlowStatus BtmNavigationFlowDetector::FlowStatusAfterNavigation(
bool did_most_recent_navigation_start_new_flow) const {
if (!current_page_visit_info_->WasNavigationToPageClientRedirect()) {
return dips::FlowStatus::kInvalidated;
return btm::FlowStatus::kInvalidated;
}
if (!successor_interaction_tracking_state_.has_value()) {
return dips::FlowStatus::kInvalidated;
return btm::FlowStatus::kInvalidated;
}
const base::span<const BtmRedirectInfoPtr> server_redirects =
@ -473,13 +472,13 @@ dips::FlowStatus BtmNavigationFlowDetector::FlowStatusAfterNavigation(
if (did_most_recent_navigation_start_new_flow) {
bool is_still_on_entrypoint = server_redirects.empty();
if (is_still_on_entrypoint) {
return dips::FlowStatus::kOngoing;
return btm::FlowStatus::kOngoing;
}
return successor_interaction_tracking_state_->flow_entrypoint().site ==
current_page_visit_info_->site
? dips::FlowStatus::kOngoing
: dips::FlowStatus::kEnded;
? btm::FlowStatus::kOngoing
: btm::FlowStatus::kEnded;
}
QuantityBucket cross_site_redirect_quantity_bucket =
@ -488,17 +487,17 @@ dips::FlowStatus BtmNavigationFlowDetector::FlowStatusAfterNavigation(
current_page_visit_info_->site);
switch (cross_site_redirect_quantity_bucket) {
case QuantityBucket::kZero:
return dips::FlowStatus::kOngoing;
return btm::FlowStatus::kOngoing;
case QuantityBucket::kOne:
return dips::FlowStatus::kEnded;
return btm::FlowStatus::kEnded;
case QuantityBucket::kMultiple:
return dips::FlowStatus::kInvalidated;
return btm::FlowStatus::kInvalidated;
}
}
bool BtmNavigationFlowDetector::
MaybeInitializeSuccessorInteractionTrackingState() {
if (flow_status_ == dips::FlowStatus::kOngoing) {
if (flow_status_ == btm::FlowStatus::kOngoing) {
return false;
}
if (!previous_page_visit_info_ || !current_page_visit_info_) {
@ -518,7 +517,7 @@ bool BtmNavigationFlowDetector::
if (can_entrypoint_be_current_page) {
if (current_page_visit_info_->site != previous_page_visit_info_->site) {
successor_interaction_tracking_state_.emplace(
dips::EntrypointInfo(*current_page_visit_info_));
btm::EntrypointInfo(*current_page_visit_info_));
return true;
}
return false;
@ -537,7 +536,7 @@ bool BtmNavigationFlowDetector::
}
successor_interaction_tracking_state_.emplace(
dips::EntrypointInfo(*possible_entrypoint, *current_page_visit_info_));
btm::EntrypointInfo(*possible_entrypoint, *current_page_visit_info_));
successor_interaction_tracking_state_->IncrementFlowIndex(
server_redirects.size());
return true;
@ -553,7 +552,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
const CookieAccessDetails& details) {
// Ignore notifications for prerenders, fenced frames, etc., and for blocked
// access attempts.
if (!dips::IsOrWasInPrimaryPage(render_frame_host) ||
if (!btm::IsOrWasInPrimaryPage(render_frame_host) ||
details.blocked_by_policy) {
return;
}
@ -563,7 +562,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
if (!first_party_url.has_value()) {
return;
}
// DIPS mitigations are only turned on when non-CHIPS 3PCs are blocked, so
// BTM is only turned on when non-CHIPS 3PCs are blocked, so
// mirror that behavior by ignoring non-CHIPS 3PC accesses.
if (!HasCHIPS(details.cookie_access_result_list) &&
!IsSameSiteForBtm(first_party_url.value(), details.url)) {
@ -571,7 +570,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
}
current_page_visit_info_->did_page_access_cookies = true;
if (flow_status_ == dips::FlowStatus::kOngoing &&
if (flow_status_ == btm::FlowStatus::kOngoing &&
!successor_interaction_tracking_state_->IsAtSuccessor()) {
successor_interaction_tracking_state_
->RecordTriggeringStorageAccessByEntrypoint();
@ -595,7 +594,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
return;
}
// DIPS mitigations are only turned on when non-CHIPS 3PCs are blocked, so
// BTM is only turned on when non-CHIPS 3PCs are blocked, so
// mirror that behavior by ignoring non-CHIPS 3PC accesses.
if (!HasCHIPS(details.cookie_access_result_list) &&
!IsSameSiteForBtm(first_party_url.value(), details.url)) {
@ -603,7 +602,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
}
current_page_visit_info_->did_page_access_cookies = true;
if (flow_status_ == dips::FlowStatus::kOngoing &&
if (flow_status_ == btm::FlowStatus::kOngoing &&
!successor_interaction_tracking_state_->IsAtSuccessor()) {
successor_interaction_tracking_state_
->RecordTriggeringStorageAccessByEntrypoint();
@ -620,7 +619,7 @@ void BtmNavigationFlowDetector::OnCookiesAccessed(
if (details.url == current_page_visit_info_->url) {
current_page_visit_info_->did_page_access_cookies = true;
if (flow_status_ == dips::FlowStatus::kOngoing &&
if (flow_status_ == btm::FlowStatus::kOngoing &&
!successor_interaction_tracking_state_->IsAtSuccessor()) {
successor_interaction_tracking_state_
->RecordTriggeringStorageAccessByEntrypoint();
@ -640,7 +639,7 @@ void BtmNavigationFlowDetector::NotifyStorageAccessed(
return;
}
current_page_visit_info_->did_page_access_storage = true;
if (flow_status_ == dips::FlowStatus::kOngoing &&
if (flow_status_ == btm::FlowStatus::kOngoing &&
!successor_interaction_tracking_state_->IsAtSuccessor()) {
successor_interaction_tracking_state_
->RecordTriggeringStorageAccessByEntrypoint();

@ -29,7 +29,7 @@ struct CookieAccessDetails;
class NavigationHandle;
class RenderFrameHost;
namespace dips {
namespace btm {
// Should match DIPSDirectNavigationSource in tools/metrics/histograms/enums.xml
enum class DirectNavigationSource {
@ -60,9 +60,9 @@ struct PageVisitInfo {
struct EntrypointInfo {
// Used when the entrypoint has a server redirect exit.
explicit EntrypointInfo(const BtmRedirectInfo& server_redirect_info,
const dips::PageVisitInfo& exit_page_info);
const btm::PageVisitInfo& exit_page_info);
// Used when the entrypoint has a client redirect exit.
explicit EntrypointInfo(const dips::PageVisitInfo& client_redirector_info);
explicit EntrypointInfo(const btm::PageVisitInfo& client_redirector_info);
const std::string site;
ukm::SourceId source_id;
@ -78,8 +78,7 @@ enum class FlowStatus {
class InFlowSuccessorInteractionState {
public:
explicit InFlowSuccessorInteractionState(
dips::EntrypointInfo flow_entrypoint);
explicit InFlowSuccessorInteractionState(btm::EntrypointInfo flow_entrypoint);
~InFlowSuccessorInteractionState();
void RecordTriggeringStorageAccessByEntrypoint();
@ -87,7 +86,7 @@ class InFlowSuccessorInteractionState {
void RecordSuccessorInteractionAtCurrentFlowIndex();
bool IsAtSuccessor() const;
const dips::EntrypointInfo& flow_entrypoint() const {
const btm::EntrypointInfo& flow_entrypoint() const {
return flow_entrypoint_;
}
size_t flow_index() const { return flow_index_; }
@ -96,12 +95,12 @@ class InFlowSuccessorInteractionState {
}
private:
dips::EntrypointInfo flow_entrypoint_;
btm::EntrypointInfo flow_entrypoint_;
size_t flow_index_ = 0;
std::vector<size_t> successor_interaction_indices_;
};
} // namespace dips
} // namespace btm
// Detects possible navigation flows with the aim of discovering how to
// distinguish user-interest navigation flows from navigational tracking.
@ -133,9 +132,9 @@ class CONTENT_EXPORT BtmNavigationFlowDetector
void MaybeEmitSuspectedTrackerFlowUkmForClientRedirectExit(int32_t flow_id);
bool CanEmitSuspectedTrackerFlowUkmForClientRedirectExit() const;
bool CanEmitSuspectedTrackerFlowUkm(
const dips::PageVisitInfo& referrer_page_info,
const dips::EntrypointInfo& entrypoint_info,
const dips::PageVisitInfo& exit_page_info) const;
const btm::PageVisitInfo& referrer_page_info,
const btm::EntrypointInfo& entrypoint_info,
const btm::PageVisitInfo& exit_page_info) const;
void MaybeEmitInFlowInteraction(int32_t flow_id);
@ -145,7 +144,7 @@ class CONTENT_EXPORT BtmNavigationFlowDetector
// So WebContentsUserData::CreateForWebContents can call the constructor.
friend class WebContentsUserData<BtmNavigationFlowDetector>;
dips::FlowStatus FlowStatusAfterNavigation(
btm::FlowStatus FlowStatusAfterNavigation(
bool did_most_recent_navigation_start_new_flow) const;
// Returns whether the entrypoint was set or not.
bool MaybeInitializeSuccessorInteractionTrackingState();
@ -174,17 +173,17 @@ class CONTENT_EXPORT BtmNavigationFlowDetector
void OnNavigationCommitted(NavigationHandle* navigation_handle) override;
// end RedirectChainDetector::Observer overrides
std::optional<dips::PageVisitInfo> two_pages_ago_visit_info_;
std::optional<dips::PageVisitInfo> previous_page_visit_info_;
std::optional<dips::PageVisitInfo> current_page_visit_info_;
std::optional<btm::PageVisitInfo> two_pages_ago_visit_info_;
std::optional<btm::PageVisitInfo> previous_page_visit_info_;
std::optional<btm::PageVisitInfo> current_page_visit_info_;
// The status of a flow for the purposes of InFlowSuccessorInteraction, after
// the most recent primary page change.
dips::FlowStatus flow_status_ = dips::FlowStatus::kInvalidated;
btm::FlowStatus flow_status_ = btm::FlowStatus::kInvalidated;
// Data needed for emitting DIPS.TrustIndicator.InFlowSuccessorInteraction.
// Set only when there's an ongoing flow that's possibly valid (we can't know
// for sure until it ends or is invalidated).
std::optional<dips::InFlowSuccessorInteractionState>
std::optional<btm::InFlowSuccessorInteractionState>
successor_interaction_tracking_state_;
// Tracks a navigational cookie access notification that is received before

@ -184,7 +184,7 @@ class BtmNavigationFlowDetectorTest : public ContentBrowserTest {
}
GURL GetSetCookieUrlForSite(std::string_view site) {
// Path set in dips_test_utils.cc's NavigateToSetCookie().
// Path set in btm_test_utils.cc's NavigateToSetCookie().
return embedded_https_test_server_.GetURL(site, "/set-cookie?name=value");
}
@ -436,7 +436,7 @@ IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
ukm_recorder().ExpectEntrySourceHasUrl(direct_navigation_entry, url);
ukm_recorder().ExpectEntryMetric(
direct_navigation_entry, "NavigationSource",
static_cast<int64_t>(dips::DirectNavigationSource::kOmnibar));
static_cast<int64_t>(btm::DirectNavigationSource::kOmnibar));
}
IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
ukm_recorder().ExpectEntrySourceHasUrl(direct_navigation_entry, url);
ukm_recorder().ExpectEntryMetric(
direct_navigation_entry, "NavigationSource",
static_cast<int64_t>(dips::DirectNavigationSource::kBookmark));
static_cast<int64_t>(btm::DirectNavigationSource::kBookmark));
}
IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
@ -481,7 +481,7 @@ IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
redirector_url);
ukm_recorder().ExpectEntryMetric(
direct_navigation_entry, "NavigationSource",
static_cast<int64_t>(dips::DirectNavigationSource::kOmnibar));
static_cast<int64_t>(btm::DirectNavigationSource::kOmnibar));
}
IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
@ -515,7 +515,7 @@ IN_PROC_BROWSER_TEST_F(BtmNavigationFlowDetectorTest,
ukm_recorder().ExpectEntrySourceHasUrl(direct_navigation_entry, initial_url);
ukm_recorder().ExpectEntryMetric(
direct_navigation_entry, "NavigationSource",
static_cast<int64_t>(dips::DirectNavigationSource::kOmnibar));
static_cast<int64_t>(btm::DirectNavigationSource::kOmnibar));
// Implied assert: no DirectNavigation UKM entry for link_target_url.
}

@ -74,7 +74,7 @@ class NavigationState
for (size_t i = 1; i < navigation_handle.GetRedirectChain().size(); ++i) {
navigation.server_redirects.emplace_back(
navigation_handle.GetRedirectChain()[i - 1],
dips::GetRedirectSourceId(&navigation_handle, i - 1),
btm::GetRedirectSourceId(&navigation_handle, i - 1),
IsWrite(accesses[i - 1]));
}
@ -164,7 +164,7 @@ void BtmPageVisitObserver::OnCookiesAccessed(
// Ignore irrelevant cookie accesses.
if (details.blocked_by_policy ||
details.type != CookieAccessDetails::Type::kChange ||
!dips::IsOrWasInPrimaryPage(render_frame_host)) {
!btm::IsOrWasInPrimaryPage(render_frame_host)) {
return;
}

@ -61,8 +61,8 @@ bool Has3pcException(BrowserContext* browser_context,
BtmRedirectInfoPtr redirect = BtmRedirectInfo::CreateForServer(
UrlAndSourceId(url, ukm::kInvalidSourceId), BtmDataAccessType::kWrite,
base::Time::Now(), false, net::HTTP_FOUND, base::TimeDelta());
dips::Populate3PcExceptions(browser_context, web_contents, initial_url,
final_url, base::span_from_ref(redirect));
btm::Populate3PcExceptions(browser_context, web_contents, initial_url,
final_url, base::span_from_ref(redirect));
return redirect->has_3pc_exception.value();
}
@ -105,14 +105,14 @@ TEST_F(BtmServiceTest, DontCreateServiceIfFeatureDisabled) {
}
// Verifies that if database persistence is disabled via Finch, then when the
// DIPS Service is constructed, it deletes any DIPS Database files for the
// BTM Service is constructed, it deletes any BTM Database files for the
// associated BrowserContext.
TEST_F(BtmServiceTest, DeleteDbFilesIfPersistenceDisabled) {
base::FilePath data_path = base::CreateUniqueTempDirectoryScopedToTest();
BtmServiceImpl* service;
std::unique_ptr<TestBrowserContext> profile;
// Ensure the DIPS feature is enabled and the database is set to be persisted.
// Ensure the BTM feature is enabled and the database is set to be persisted.
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeatureWithParameters(
features::kBtm, {{"persist_database", "true"}});
@ -122,7 +122,7 @@ TEST_F(BtmServiceTest, DeleteDbFilesIfPersistenceDisabled) {
ASSERT_NE(service, nullptr);
// Ensure the database files have been created and are NOT deleted since the
// DIPS feature is enabled.
// BTM feature is enabled.
WaitOnStorage(service);
service->WaitForFileDeletionCompleteForTesting();
ASSERT_TRUE(base::PathExists(GetBtmFilePath(profile.get())));
@ -140,18 +140,18 @@ TEST_F(BtmServiceTest, DeleteDbFilesIfPersistenceDisabled) {
service = BtmServiceImpl::Get(profile.get());
ASSERT_NE(service, nullptr);
// Ensure the database files ARE deleted since the DIPS feature is disabled.
// Ensure the database files ARE deleted since the BTM feature is disabled.
WaitOnStorage(service);
service->WaitForFileDeletionCompleteForTesting();
EXPECT_FALSE(base::PathExists(GetBtmFilePath(profile.get())));
}
// Verifies that when an OTR profile is opened, the DIPS database file for
// Verifies that when an OTR profile is opened, the BTM database file for
// the underlying regular profile is NOT deleted.
TEST_F(BtmServiceTest, PreserveRegularProfileDbFiles) {
base::FilePath data_path = base::CreateUniqueTempDirectoryScopedToTest();
// Ensure the DIPS feature is enabled and the database is set to be persisted.
// Ensure the BTM feature is enabled and the database is set to be persisted.
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeatureWithParameters(
features::kBtm, {{"persist_database", "true"}});
@ -163,7 +163,7 @@ TEST_F(BtmServiceTest, PreserveRegularProfileDbFiles) {
ASSERT_NE(service, nullptr);
// Ensure the regular profile's database files have been created since the
// DIPS feature and persistence are enabled.
// BTM feature and persistence are enabled.
WaitOnStorage(service);
service->WaitForFileDeletionCompleteForTesting();
ASSERT_TRUE(base::PathExists(GetBtmFilePath(profile.get())));
@ -344,9 +344,9 @@ TEST_F(BtmServiceStateRemovalTest,
/*final_url=*/MakeUrlAndId("http://c.test/"),
/*length=*/1, /*is_partial_chain=*/false);
dips::Populate3PcExceptions(
GetProfile(), /*web_contents=*/nullptr, complete_chain->initial_url.url,
complete_chain->final_url.url, complete_redirects);
btm::Populate3PcExceptions(GetProfile(), /*web_contents=*/nullptr,
complete_chain->initial_url.url,
complete_chain->final_url.url, complete_redirects);
GetService()->HandleRedirectChain(
std::move(complete_redirects), std::move(complete_chain),
base::BindRepeating([](const GURL& final_url) {}));
@ -373,9 +373,9 @@ TEST_F(BtmServiceStateRemovalTest,
/*final_url=*/MakeUrlAndId("http://c.test/"),
/*length=*/1, /*is_partial_chain=*/true);
dips::Populate3PcExceptions(GetProfile(), /*web_contents=*/nullptr,
partial_chain->initial_url.url,
partial_chain->final_url.url, partial_redirects);
btm::Populate3PcExceptions(GetProfile(), /*web_contents=*/nullptr,
partial_chain->initial_url.url,
partial_chain->final_url.url, partial_redirects);
GetService()->HandleRedirectChain(
std::move(partial_redirects), std::move(partial_chain),
base::BindRepeating([](const GURL& final_url) {}));
@ -385,8 +385,8 @@ TEST_F(BtmServiceStateRemovalTest,
}
// NOTE: The use of a MockBrowsingDataRemoverDelegate in this test fixture
// means that when DIPS deletion is enabled, the row for 'url' is not actually
// removed from the DIPS db since 'delegate_' doesn't actually carryout the
// means that when BTM deletion is enabled, the row for 'url' is not actually
// removed from the BTM db since 'delegate_' doesn't actually carryout the
// removal task.
TEST_F(BtmServiceStateRemovalTest, DISABLED_BrowsingDataDeletion_Enabled) {
ukm::TestAutoSetUkmRecorder ukm_recorder;
@ -440,7 +440,7 @@ TEST_F(BtmServiceStateRemovalTest, DISABLED_BrowsingDataDeletion_Enabled) {
// Verify that a removal task was posted to the BrowsingDataRemover(Delegate)
// for 'url'.
delegate_.VerifyAndClearExpectations();
// Because this test fixture uses a MockBrowsingDataRemoverDelegate the DIPS
// Because this test fixture uses a MockBrowsingDataRemoverDelegate the BTM
// entry should not actually be removed. However, in practice it would be.
EXPECT_TRUE(GetBtmState(GetService(), url).has_value());
@ -468,7 +468,7 @@ TEST_F(BtmServiceStateRemovalTest, BrowsingDataDeletion_Disabled) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify the DIPS entry was not removed and a removal task was not posted to
// Verify the BTM entry was not removed and a removal task was not posted to
// the BrowsingDataRemover(Delegate).
delegate_.VerifyAndClearExpectations();
EXPECT_TRUE(GetBtmState(GetService(), url).has_value());
@ -478,7 +478,7 @@ TEST_F(BtmServiceStateRemovalTest, BrowsingDataDeletion_Disabled) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify that the site's DIPS entry WAS removed, but a removal task was NOT
// Verify that the site's BTM entry WAS removed, but a removal task was NOT
// posted to the BrowsingDataRemover(Delegate) since
// `features::kBtmDeletionEnabled` is false.
delegate_.VerifyAndClearExpectations();
@ -784,7 +784,7 @@ TEST_F(BtmServiceStateRemovalTest, ImmediateEnforcement) {
EXPECT_TRUE(GetBtmState(GetService(), url).has_value());
// Set the current time to just after the bounce happened and simulate firing
// the DIPS timer.
// the BTM timer.
AdvanceTimeTo(bounce + tiny_delta);
FireBtmTimer();
task_environment_.RunUntilIdle();
@ -876,7 +876,7 @@ TEST_F(BtmServiceHistogramTest, DeletionLatency) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify deletion latency metrics were NOT emitted and the DIPS entry was NOT
// Verify deletion latency metrics were NOT emitted and the BTM entry was NOT
// removed.
histograms().ExpectTotalCount("Privacy.DIPS.DeletionLatency2", 0);
EXPECT_TRUE(GetBtmState(GetService(), url).has_value());
@ -886,7 +886,7 @@ TEST_F(BtmServiceHistogramTest, DeletionLatency) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify a deletion latency metric was emitted and the DIPS entry was
// Verify a deletion latency metric was emitted and the BTM entry was
// removed.
histograms().ExpectTotalCount("Privacy.DIPS.DeletionLatency2", 1);
EXPECT_FALSE(GetBtmState(GetService(), url).has_value());
@ -916,7 +916,7 @@ TEST_F(BtmServiceHistogramTest, Deletion_Disallowed) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify a deletion metric was emitted and the DIPS entry was removed.
// Verify a deletion metric was emitted and the BTM entry was removed.
base::HistogramTester::CountsMap expected_counts;
expected_counts[kUmaHistogramDeletionPrefix + kBlock3PC] = 1;
EXPECT_THAT(histograms().GetTotalCountsForPrefix(kUmaHistogramDeletionPrefix),
@ -951,7 +951,7 @@ TEST_F(BtmServiceHistogramTest, Deletion_ExceptedAs1P) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify a deletion metric was emitted and the DIPS entry was removed.
// Verify a deletion metric was emitted and the BTM entry was removed.
base::HistogramTester::CountsMap expected_counts;
expected_counts[kUmaHistogramDeletionPrefix + kBlock3PC] = 1;
EXPECT_THAT(histograms().GetTotalCountsForPrefix(kUmaHistogramDeletionPrefix),
@ -986,7 +986,7 @@ TEST_F(BtmServiceHistogramTest, Deletion_ExceptedAs3P) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify a deletion metric was emitted and the DIPS entry was removed.
// Verify a deletion metric was emitted and the BTM entry was removed.
base::HistogramTester::CountsMap expected_counts;
expected_counts[kUmaHistogramDeletionPrefix + kBlock3PC] = 1;
EXPECT_THAT(histograms().GetTotalCountsForPrefix(kUmaHistogramDeletionPrefix),
@ -1020,7 +1020,7 @@ TEST_F(BtmServiceHistogramTest, DISABLED_Deletion_Enforced) {
FireBtmTimer();
task_environment_.RunUntilIdle();
// Verify a deletion metric was emitted and the DIPS entry was not removed.
// Verify a deletion metric was emitted and the BTM entry was not removed.
base::HistogramTester::CountsMap expected_counts;
expected_counts[kUmaHistogramDeletionPrefix + kBlock3PC] = 1;
EXPECT_THAT(histograms().GetTotalCountsForPrefix(kUmaHistogramDeletionPrefix),
@ -1068,9 +1068,9 @@ TEST_F(BtmServiceHistogramTest, ServerBounceDelay) {
BtmRedirectChainInfoPtr chain = std::make_unique<BtmRedirectChainInfo>(
initial_url, UrlAndSourceId(), redirects.size(),
/*is_partial_chain=*/false);
dips::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
btm::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
service->HandleRedirectChain(std::move(redirects), std::move(chain),
base::DoNothing());
observer.Wait();
@ -1134,8 +1134,8 @@ TEST_F(BtmServiceUkmTest, BothChainBeginAndChainEnd) {
initial_url, final_url,
/*length=*/2, /*is_partial_chain=*/false);
const int32_t chain_id = chain->chain_id;
dips::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
initial_url.url, final_url.url, redirects);
btm::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
initial_url.url, final_url.url, redirects);
service->HandleRedirectChain(std::move(redirects), std::move(chain),
base::DoNothing());
observer.Wait();
@ -1187,9 +1187,9 @@ TEST_F(BtmServiceUkmTest, InitialAndFinalSitesSame_True) {
BtmRedirectChainInfoPtr chain = std::make_unique<BtmRedirectChainInfo>(
initial_url, final_url,
/*length=*/1, /*is_partial_chain=*/false);
dips::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
btm::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
service->HandleRedirectChain(std::move(redirects), std::move(chain),
base::DoNothing());
observer.Wait();
@ -1254,9 +1254,9 @@ TEST_F(BtmServiceUkmTest, DontReportChainBeginIfInvalidSourceId) {
BtmRedirectChainInfoPtr chain = std::make_unique<BtmRedirectChainInfo>(
UrlAndSourceId(), final_url,
/*length=*/1, /*is_partial_chain=*/false);
dips::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
btm::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
service->HandleRedirectChain(std::move(redirects), std::move(chain),
base::DoNothing());
observer.Wait();
@ -1290,9 +1290,9 @@ TEST_F(BtmServiceUkmTest, DontReportChainEndIfInvalidSourceId) {
BtmRedirectChainInfoPtr chain = std::make_unique<BtmRedirectChainInfo>(
initial_url, UrlAndSourceId(),
/*length=*/1, /*is_partial_chain=*/false);
dips::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
btm::Populate3PcExceptions(&profile, /*web_contents=*/nullptr,
chain->initial_url.url, chain->final_url.url,
redirects);
service->HandleRedirectChain(std::move(redirects), std::move(chain),
base::DoNothing());
observer.Wait();

@ -63,15 +63,15 @@ void OpenerHeuristicTabHelper::InitPopup(
popup_observer_ =
std::make_unique<PopupObserver>(web_contents(), popup_url, opener);
BtmServiceImpl* dips =
BtmServiceImpl* btm_service =
BtmServiceImpl::Get(web_contents()->GetBrowserContext());
if (!dips) {
// If DIPS is disabled, we can't look up past interaction.
if (!btm_service) {
// If BTM is disabled, we can't look up past interaction.
// TODO(rtarpine): consider falling back to SiteEngagementService.
return;
}
dips->storage()
btm_service->storage()
->AsyncCall(&BtmStorage::Read)
.WithArgs(popup_url)
.Then(base::BindOnce(&OpenerHeuristicTabHelper::GotPopupDipsState,
@ -204,7 +204,7 @@ void OpenerHeuristicTabHelper::PopupObserver::SetPastInteractionTimeAndType(
}
// TODO(rtarpine): consider ignoring interactions that are too old. (This
// shouldn't happen since DIPS already discards old timestamps.)
// shouldn't happen since BTM already discards old timestamps.)
EmitPastInteractionIfReady();
}
@ -261,7 +261,7 @@ void OpenerHeuristicTabHelper::PopupObserver::DidFinishNavigation(
if (navigation_handle->GetRedirectChain().size() > 1) {
// Get a source id for the URL the popup was originally opened with,
// even though the user was redirected elsewhere.
initial_source_id_ = dips::GetRedirectSourceId(navigation_handle, 0);
initial_source_id_ = btm::GetRedirectSourceId(navigation_handle, 0);
} else {
// No redirect happened, get the source id for the committed page.
initial_source_id_ = navigation_handle->GetNextPageUkmSourceId();
@ -349,10 +349,10 @@ void OpenerHeuristicTabHelper::OnCookiesAccessed(
void OpenerHeuristicTabHelper::OnCookiesAccessed(
const ukm::SourceId& source_id,
const CookieAccessDetails& details) {
BtmServiceImpl* dips =
BtmServiceImpl* btm_service =
BtmServiceImpl::Get(web_contents()->GetBrowserContext());
if (!dips) {
// If DIPS is disabled, we can't look up past popup events.
if (!btm_service) {
// If BTM is disabled, we can't look up past popup events.
// TODO(rtarpine): consider falling back to SiteEngagementService.
return;
}
@ -363,7 +363,7 @@ void OpenerHeuristicTabHelper::OnCookiesAccessed(
return;
}
dips->storage()
btm_service->storage()
->AsyncCall(&BtmStorage::ReadPopup)
.WithArgs(GetSiteForBtm(details.first_party_url),
GetSiteForBtm(details.url))
@ -401,9 +401,9 @@ void OpenerHeuristicTabHelper::PopupObserver::EmitTopLevelAndCreateGrant(
uint64_t access_id = base::RandUint64();
if (should_record_popup_and_maybe_grant) {
if (BtmServiceImpl* dips =
if (BtmServiceImpl* btm_service =
BtmServiceImpl::Get(web_contents()->GetBrowserContext())) {
dips->storage()
btm_service->storage()
->AsyncCall(&BtmStorage::WritePopup)
.WithArgs(GetSiteForBtm(opener_origin_), GetSiteForBtm(popup_url),
access_id,

@ -7630,8 +7630,8 @@ be describing additional metrics about the same event.
<metric name="HasStickyActivation" enum="BooleanHasUserActivation">
<summary>
Populated for client redirects only. Whether the user interacted with the
page (See the HTML spec for a definition). This info is persistem within
DIPS for a duration of `dips::kInteractionTtl`.
page (See the HTML spec for a definition). This info is persisted within
BTM for a duration of `btm::kInteractionTtl`.
</summary>
</metric>
<metric name="InitialAndFinalSitesSame" enum="BooleanSameSite">
@ -7683,8 +7683,8 @@ be describing additional metrics about the same event.
enum="BooleanWebAuthnAssertionRequestSucceeded">
<summary>
Populated for client redirects only. Whether the user triggered a
successful web authn assertion. This info is persistem within DIPS for a
duration of `dips::kInteractionTtl`.
successful web authn assertion. This info is persisted within BTM for a
duration of `btm::kInteractionTtl`.
</summary>
</metric>
</event>