Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert Implement "reduce language fingerprinting" and follow ups #13903

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/brave_settings_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@
<message name="IDS_SETTINGS_DE_AMP_SUB_LABEL" desc="The sub-label describing De-AMP feature">
Always visit original (non-AMP) page URLs, instead of Google's Accelerated Mobile Page versions
</message>
<message name="IDS_SETTINGS_BRAVE_SHIELDS_REDUCE_LANGUAGE_CONTROL_LABEL" desc="Default Brave reduce language control setting label">
Prevent sites from fingerprinting me based on my language preferences
</message>
<message name="IDS_SETTINGS_BRAVE_SHIELDS_REDUCE_LANGUAGE_SUBITEM" desc="Description that shows under main toggle setting for reduce language control setting label">
Enabling this setting reduces how much web sites can learn about your language preferences.
</message>
<message name="IDS_SETTINGS_BRAVE_SHIELDS_AD_CONTROL_LABEL" desc="Default Brave block cross-site trackers control setting label">
Trackers &amp; ads blocking
</message>
Expand Down
9 changes: 0 additions & 9 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ using brave_shields::features::kBraveDarkModeBlock;
using brave_shields::features::kBraveDomainBlock;
using brave_shields::features::kBraveDomainBlock1PES;
using brave_shields::features::kBraveExtensionNetworkBlocking;
using brave_shields::features::kBraveReduceLanguage;
using brave_shields::features::kCosmeticFilteringSyncLoad;

using de_amp::features::kBraveDeAMP;
Expand Down Expand Up @@ -140,10 +139,6 @@ constexpr char kBraveExtensionNetworkBlockingName[] =
constexpr char kBraveExtensionNetworkBlockingDescription[] =
"Enable blocking for network requests initiated by extensions";

constexpr char kBraveReduceLanguageName[] = "Reduce language identifiability";
constexpr char kBraveReduceLanguageDescription[] =
"Reduce the identifiability of my language preferences";

constexpr char kCosmeticFilteringSyncLoadName[] =
"Enable sync loading of cosmetic filter rules";
constexpr char kCosmeticFilteringSyncLoadDescription[] =
Expand Down Expand Up @@ -517,10 +512,6 @@ const flags_ui::FeatureEntry::Choice kBraveSkusEnvChoices[] = {
flag_descriptions::kBraveExtensionNetworkBlockingName, \
flag_descriptions::kBraveExtensionNetworkBlockingDescription, kOsAll, \
FEATURE_VALUE_TYPE(kBraveExtensionNetworkBlocking)}, \
{"brave-reduce-language", \
flag_descriptions::kBraveReduceLanguageName, \
flag_descriptions::kBraveReduceLanguageDescription, kOsAll, \
FEATURE_VALUE_TYPE(kBraveReduceLanguage)}, \
{"brave-cosmetic-filtering-sync-load", \
flag_descriptions::kCosmeticFilteringSyncLoadName, \
flag_descriptions::kCosmeticFilteringSyncLoadDescription, kOsAll, \
Expand Down
2 changes: 0 additions & 2 deletions browser/brave_browser_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace brave {
class BraveReferralsService;
class BraveP3AService;
class BraveFarblingService;
} // namespace brave

namespace brave_component_updater {
Expand Down Expand Up @@ -105,7 +104,6 @@ class BraveBrowserProcess {
speedreader_rewriter_service() = 0;
#endif
virtual brave_ads::ResourceComponent* resource_component() = 0;
virtual brave::BraveFarblingService* brave_farbling_service() = 0;
};

extern BraveBrowserProcess* g_brave_browser_process;
Expand Down
9 changes: 0 additions & 9 deletions browser/brave_browser_process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "brave/browser/brave_browser_process_impl.h"

#include <string>
#include <utility>

#include "base/bind.h"
Expand All @@ -26,7 +25,6 @@
#include "brave/components/brave_shields/browser/ad_block_regional_service_manager.h"
#include "brave/components/brave_shields/browser/ad_block_service.h"
#include "brave/components/brave_shields/browser/ad_block_subscription_service_manager.h"
#include "brave/components/brave_shields/browser/brave_farbling_service.h"
#include "brave/components/brave_shields/browser/https_everywhere_service.h"
#include "brave/components/brave_sync/network_time_helper.h"
#include "brave/components/constants/pref_names.h"
Expand All @@ -48,7 +46,6 @@
#include "content/public/browser/child_process_security_policy.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "url/gurl.h"

#if BUILDFLAG(ENABLE_BRAVE_REFERRALS)
#include "brave/components/brave_referrals/browser/brave_referrals_service.h"
Expand Down Expand Up @@ -383,9 +380,3 @@ ipfs::BraveIpfsClientUpdater* BraveBrowserProcessImpl::ipfs_client_updater() {
return ipfs_client_updater_.get();
}
#endif // BUILDFLAG(ENABLE_IPFS)

brave::BraveFarblingService* BraveBrowserProcessImpl::brave_farbling_service() {
if (!brave_farbling_service_)
brave_farbling_service_ = std::make_unique<brave::BraveFarblingService>();
return brave_farbling_service_.get();
}
4 changes: 0 additions & 4 deletions browser/brave_browser_process_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace brave {
class BraveReferralsService;
class BraveP3AService;
class HistogramsBraveizer;
class BraveFarblingService;
} // namespace brave

namespace brave_component_updater {
Expand Down Expand Up @@ -116,7 +115,6 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess,
speedreader::SpeedreaderRewriterService* speedreader_rewriter_service()
override;
#endif
brave::BraveFarblingService* brave_farbling_service() override;

private:
// BrowserProcessImpl overrides:
Expand Down Expand Up @@ -175,8 +173,6 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess,
speedreader_rewriter_service_;
#endif

std::unique_ptr<brave::BraveFarblingService> brave_farbling_service_;

SEQUENCE_CHECKER(sequence_checker_);
};

Expand Down
22 changes: 9 additions & 13 deletions browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h"
#include "base/system/sys_info.h"
#include "brave/browser/brave_browser_main_extra_parts.h"
#include "brave/browser/brave_browser_process.h"
#include "brave/browser/brave_shields/brave_shields_web_contents_observer.h"
#include "brave/browser/brave_shields/reduce_language_navigation_throttle.h"
#include "brave/browser/brave_wallet/brave_wallet_context_utils.h"
#include "brave/browser/brave_wallet/brave_wallet_provider_delegate_impl.h"
#include "brave/browser/brave_wallet/brave_wallet_service_factory.h"
Expand All @@ -44,7 +44,6 @@
#include "brave/components/brave_search/common/brave_search_fallback.mojom.h"
#include "brave/components/brave_search/common/brave_search_utils.h"
#include "brave/components/brave_shields/browser/ad_block_service.h"
#include "brave/components/brave_shields/browser/brave_farbling_service.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
#include "brave/components/brave_shields/browser/domain_block_navigation_throttle.h"
#include "brave/components/brave_shields/common/brave_shield_constants.h"
Expand Down Expand Up @@ -378,7 +377,9 @@ void MaybeBindSkusSdkImpl(

} // namespace

BraveContentBrowserClient::BraveContentBrowserClient() {}
BraveContentBrowserClient::BraveContentBrowserClient()
: session_token_(base::RandUint64()),
incognito_session_token_(base::RandUint64()) {}

BraveContentBrowserClient::~BraveContentBrowserClient() {}

Expand Down Expand Up @@ -653,9 +654,11 @@ void BraveContentBrowserClient::AppendExtraCommandLineSwitches(
Profile* profile =
process ? Profile::FromBrowserContext(process->GetBrowserContext())
: nullptr;
session_token =
g_brave_browser_process->brave_farbling_service()->session_token(
profile && !profile->IsOffTheRecord());
if (profile && !profile->IsOffTheRecord()) {
session_token = session_token_;
} else {
session_token = incognito_session_token_;
}
}
command_line->AppendSwitchASCII("brave_session_token",
base::NumberToString(session_token));
Expand Down Expand Up @@ -956,13 +959,6 @@ BraveContentBrowserClient::CreateThrottlesForNavigation(
g_browser_process->GetApplicationLocale()))
throttles.push_back(std::move(domain_block_navigation_throttle));

if (std::unique_ptr<content::NavigationThrottle>
reduce_language_navigation_throttle = brave_shields::
ReduceLanguageNavigationThrottle::MaybeCreateThrottleFor(
handle, HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(context))))
throttles.push_back(std::move(reduce_language_navigation_throttle));

return throttles;
}

Expand Down
3 changes: 3 additions & 0 deletions browser/brave_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient {
blink::UserAgentMetadata GetUserAgentMetadata() override;

private:
uint64_t session_token_;
uint64_t incognito_session_token_;

void OnAllowGoogleAuthChanged();

std::unique_ptr<PrefChangeRegistrar, content::BrowserThread::DeleteOnUIThread>
Expand Down
2 changes: 0 additions & 2 deletions browser/brave_prefs_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ IN_PROC_BROWSER_TEST_F(BraveProfilePrefsBrowserTest, MiscBravePrefs) {
brave_shields::prefs::kTwitterEmbedControlType));
EXPECT_FALSE(chrome_test_utils::GetProfile(this)->GetPrefs()->GetBoolean(
brave_shields::prefs::kLinkedInEmbedControlType));
EXPECT_TRUE(chrome_test_utils::GetProfile(this)->GetPrefs()->GetBoolean(
brave_shields::prefs::kReduceLanguageEnabled));
#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE)
EXPECT_TRUE(chrome_test_utils::GetProfile(this)->GetPrefs()->GetBoolean(
kWebTorrentEnabled));
Expand Down
3 changes: 0 additions & 3 deletions browser/brave_profile_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "brave/components/brave_search/browser/brave_search_default_host.h"
#include "brave/components/brave_search/common/brave_search_utils.h"
#include "brave/components/brave_search_conversion/utils.h"
#include "brave/components/brave_shields/browser/brave_farbling_service.h"
#include "brave/components/brave_shields/browser/brave_shields_p3a.h"
#include "brave/components/brave_shields/common/pref_names.h"
#include "brave/components/brave_sync/brave_sync_prefs.h"
Expand Down Expand Up @@ -456,8 +455,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
policy::policy_prefs::kIsolatedAppsDeveloperModeAllowed,
base::Value(false));

BraveFarblingService::RegisterProfilePrefs(registry);

RegisterProfilePrefsForMigration(registry);

#if BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)
Expand Down
18 changes: 0 additions & 18 deletions browser/brave_shields/brave_shields_web_contents_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "brave/components/brave_shields/browser/brave_shields_util.h"
#include "brave/components/brave_shields/common/brave_shield_constants.h"
#include "brave/components/brave_shields/common/features.h"
#include "brave/components/brave_shields/common/pref_names.h"
#include "brave/components/constants/pref_names.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
Expand Down Expand Up @@ -72,14 +70,6 @@ void BraveShieldsWebContentsObserver::RenderFrameCreated(RenderFrameHost* rfh) {
GetBraveShieldsRemote(rfh)->SetAllowScriptsFromOriginsOnce(
allowed_script_origins_);
}
if (rfh) {
if (content::BrowserContext* context = rfh->GetBrowserContext()) {
if (PrefService* pref_service = user_prefs::UserPrefs::Get(context)) {
GetBraveShieldsRemote(rfh)->SetReduceLanguageEnabled(
brave_shields::IsReduceLanguageEnabledForProfile(pref_service));
}
}
}
}

void BraveShieldsWebContentsObserver::RenderFrameDeleted(RenderFrameHost* rfh) {
Expand Down Expand Up @@ -252,14 +242,6 @@ void BraveShieldsWebContentsObserver::ReadyToCommitNavigation(
observer->GetBraveShieldsRemote(rfh)
->SetAllowScriptsFromOriginsOnce(
observer->allowed_script_origins_);
if (content::BrowserContext* context = rfh->GetBrowserContext()) {
if (PrefService* pref_service =
user_prefs::UserPrefs::Get(context)) {
observer->GetBraveShieldsRemote(rfh)->SetReduceLanguageEnabled(
brave_shields::IsReduceLanguageEnabledForProfile(
pref_service));
}
}
},
base::Unretained(this)));
}
Expand Down
116 changes: 0 additions & 116 deletions browser/brave_shields/reduce_language_navigation_throttle.cc

This file was deleted.

Loading