Skip to content

Commit

Permalink
14942: Disable FLoC features and the provider service.
Browse files Browse the repository at this point in the history
  • Loading branch information
iefremov committed Apr 7, 2021
1 parent 436bda9 commit c6a2754
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ include_rules = [
"+content/public/test",
"+components/autofill/core/common",
"+components/embedder_support/switches.h",
"+components/federated_learning/features/features.h",
"+components/feed/feed_feature_list.h",
"+components/language/core/common",
"+components/network_time/network_time_tracker.h",
Expand Down
6 changes: 6 additions & 0 deletions app/brave_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/embedder_support/switches.h"
#include "components/federated_learning/features/features.h"
#include "components/feed/feed_feature_list.h"
#include "components/language/core/common/language_experiments.h"
#include "components/network_time/network_time_tracker.h"
Expand Down Expand Up @@ -216,6 +217,8 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) {
std::unordered_set<const char*> disabled_features = {
autofill::features::kAutofillEnableAccountWalletStorage.name,
autofill::features::kAutofillServerCommunication.name,
blink::features::kInterestCohortAPIOriginTrial.name,
blink::features::kInterestCohortFeaturePolicy.name,
blink::features::kTextFragmentAnchor.name,
features::kDirectSockets.name,
features::kIdleDetection.name,
Expand All @@ -226,6 +229,9 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) {
features::kSubresourceWebBundles.name,
features::kTabHoverCards.name,
features::kWebOTP.name,
federated_learning::kFederatedLearningOfCohorts.name,
federated_learning::kFlocIdComputedEventLogging.name,
federated_learning::kFlocIdSortingLshBasedComputation.name,
kSharingQRCodeGenerator.name,
network_time::kNetworkTimeServiceQuerying.name,
safe_browsing::kEnhancedProtection.name,
Expand Down
6 changes: 6 additions & 0 deletions app/brave_main_delegate_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/embedder_support/switches.h"
#include "components/federated_learning/features/features.h"
#include "components/language/core/common/language_experiments.h"
#include "components/network_time/network_time_tracker.h"
#include "components/omnibox/common/omnibox_features.h"
Expand Down Expand Up @@ -66,6 +67,8 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) {
const base::Feature* disabled_features[] = {
&autofill::features::kAutofillEnableAccountWalletStorage,
&autofill::features::kAutofillServerCommunication,
&blink::features::kInterestCohortAPIOriginTrial,
&blink::features::kInterestCohortFeaturePolicy,
&blink::features::kTextFragmentAnchor,
&features::kDirectSockets,
&features::kIdleDetection,
Expand All @@ -76,6 +79,9 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) {
&features::kSubresourceWebBundles,
&features::kTabHoverCards,
&features::kWebOTP,
&federated_learning::kFederatedLearningOfCohorts,
&federated_learning::kFlocIdComputedEventLogging,
&federated_learning::kFlocIdSortingLshBasedComputation,
&kSharingQRCodeGenerator,
&network_time::kNetworkTimeServiceQuerying,
&safe_browsing::kEnhancedProtection,
Expand Down
1 change: 1 addition & 0 deletions chromium_src/chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include_rules = [
"+../../../../../../../chrome/browser/extensions/api/developer_private",
"+../../../../../../../chrome/browser/extensions/api/settings_private",
"+../../../../../../../chrome/browser/extensions/api/webrtc_logging_private",
"+../../../../../chrome/browser/federated_learning",
"+../../../../../chrome/browser/first_run",
"+../../../../../chrome/browser/history",
"+../../../../../chrome/browser/importer",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* you can obtain one at http://mozilla.org/MPL/2.0/. */

#include "chrome/browser/federated_learning/floc_id_provider_factory.h"

#include "chrome/browser/federated_learning/floc_remote_permission_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/user_event_service_factory.h"

#define BuildServiceInstanceFor BuildServiceInstanceFor_ChromiumImpl
#include "../../../../../chrome/browser/federated_learning/floc_id_provider_factory.cc" // NOLINT
#undef BuildServiceInstanceFor

namespace federated_learning {

// We don't want FLoC:
// https://github.com/brave/brave-browser/issues/14942
KeyedService* FlocIdProviderFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return nullptr;
}

} // namespace federated_learning
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* you can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_FEDERATED_LEARNING_FLOC_ID_PROVIDER_FACTORY_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_FEDERATED_LEARNING_FLOC_ID_PROVIDER_FACTORY_H_

#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

#define BuildServiceInstanceFor \
BuildServiceInstanceFor_ChromiumImpl(content::BrowserContext* context) \
const; \
KeyedService* BuildServiceInstanceFor
#include "../../../../../chrome/browser/federated_learning/floc_id_provider_factory.h"
#undef BuildServiceInstanceFor

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_FEDERATED_LEARNING_FLOC_ID_PROVIDER_FACTORY_H_
1 change: 1 addition & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ if (!is_android) {
"//components/content_settings/renderer",
"//components/crx_file",
"//components/embedder_support",
"//components/federated_learning:federated_learning",
"//components/language/core/common",
"//components/network_time",
"//components/permissions",
Expand Down

0 comments on commit c6a2754

Please sign in to comment.