Incognito data removed from PrivacySandboxSettings

Chromium change:
https://chromium.googlesource.com/chromium/src/+/eb304675fb1fa4e00862d7873413e2b4a96d53a7

commit eb304675fb1fa4e00862d7873413e2b4a96d53a7
Author: Rohit Agarwal <roagarwal@chromium.org>
Date:   Thu Dec 1 08:22:44 2022 +0000

    Privacy Sandbox Settings: Move incognito logic to delegate

    This CL moves the incognito check from PrivacySandboxSettings to
    PrivacySandboxSettingsDelegate instead which is more appropriate place
    to hold that information.

    Bug: 1378703
This commit is contained in:
Claudio DeSouza
2023-01-25 07:42:28 +00:00
parent 6bd8388dfd
commit ea62f03f18
4 changed files with 7 additions and 11 deletions
@@ -18,6 +18,5 @@ KeyedService* PrivacySandboxSettingsFactory::BuildServiceInstanceFor(
return new BravePrivacySandboxSettings(
std::make_unique<PrivacySandboxSettingsDelegate>(profile),
HostContentSettingsMapFactory::GetForProfile(profile),
CookieSettingsFactory::GetForProfile(profile).get(), profile->GetPrefs(),
profile->IsIncognitoProfile());
CookieSettingsFactory::GetForProfile(profile).get(), profile->GetPrefs());
}
@@ -30,7 +30,8 @@ class MockPrivacySandboxDelegate : public PrivacySandboxSettings::Delegate {
return false;
});
}
MOCK_METHOD(bool, IsPrivacySandboxRestricted, (), (override));
MOCK_METHOD(bool, IsPrivacySandboxRestricted, (), (const, override));
MOCK_METHOD(bool, IsIncognitoProfile, (), (const, override));
};
class PrivacySandboxSettingsTest : public testing::Test {
@@ -60,8 +61,7 @@ class PrivacySandboxSettingsTest : public testing::Test {
privacy_sandbox_settings_ = std::make_unique<BravePrivacySandboxSettings>(
std::move(mock_delegate), host_content_settings_map(),
cookie_settings(), prefs(),
/*incognito_profile=*/false);
cookie_settings(), prefs());
}
virtual void InitializePrefsBeforeStart() {}
@@ -17,13 +17,11 @@ BravePrivacySandboxSettings::BravePrivacySandboxSettings(
std::unique_ptr<Delegate> delegate,
HostContentSettingsMap* host_content_settings_map,
content_settings::CookieSettings* cookie_settings,
PrefService* pref_service,
bool incognito_profile)
PrefService* pref_service)
: privacy_sandbox::PrivacySandboxSettings(std::move(delegate),
host_content_settings_map,
cookie_settings,
pref_service,
incognito_profile),
pref_service),
pref_service_(pref_service) {
// Register observers for the Privacy Sandbox.
user_prefs_registrar_.Init(pref_service_);
@@ -25,8 +25,7 @@ class BravePrivacySandboxSettings
BravePrivacySandboxSettings(std::unique_ptr<Delegate> delegate,
HostContentSettingsMap* host_content_settings_map,
content_settings::CookieSettings* cookie_settings,
PrefService* pref_service,
bool incognito_profile);
PrefService* pref_service);
~BravePrivacySandboxSettings() override;
private: