Skip to content

Commit 01d8307

Browse files
author
Mihai Sardarescu
committed
[unified-consent] Move IsUnifiedConsentFeatureEnabled to components/unified_consent.
Unified Consent feature is no longer dependent on Desktop Identity Consistency being enabled. This means that the Unified Consent feature is no longer a per-profile feature. This CL removes the argument profile from IsUnifiedConsentFeatureEnabled and IsUnifiedConsentFeatureWithBumpEnabled and moves these functions in the unified consent component. Bug: 873064 Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs Change-Id: Ifc338dbcb48500bc17d52bf5bcf52a45ea46860d Reviewed-on: https://chromium-review.googlesource.com/1202702 Commit-Queue: Mihai Sardarescu <[email protected]> Reviewed-by: Steven Holte <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Reviewed-by: David Roger <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#588891} Reviewed-on: https://chromium-review.googlesource.com/1209362 Reviewed-by: Mihai Sardarescu <[email protected]> Cr-Commit-Position: refs/branch-heads/3538@{#85} Cr-Branched-From: 79f7c91-refs/heads/master@{#587811}
1 parent b97ba7c commit 01d8307

File tree

56 files changed

+231
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+231
-310
lines changed

chrome/browser/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,6 @@ jumbo_split_static_library("browser") {
14351435
"signin/signin_tracker_factory.h",
14361436
"signin/signin_util.cc",
14371437
"signin/signin_util.h",
1438-
"signin/unified_consent_helper.cc",
1439-
"signin/unified_consent_helper.h",
14401438
"site_details.cc",
14411439
"site_details.h",
14421440
"speech/chrome_speech_recognition_manager_delegate.cc",

chrome/browser/android/contextualsearch/contextual_search_delegate.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "chrome/browser/language/language_model_manager_factory.h"
2121
#include "chrome/browser/profiles/profile.h"
2222
#include "chrome/browser/profiles/profile_manager.h"
23-
#include "chrome/browser/signin/unified_consent_helper.h"
2423
#include "chrome/browser/sync/profile_sync_service_factory.h"
2524
#include "chrome/browser/translate/translate_service.h"
2625
#include "chrome/common/pref_names.h"
@@ -392,7 +391,6 @@ bool ContextualSearchDelegate::CanSendPageURL(
392391
anonymized_unified_consent_url_helper =
393392
UrlKeyedDataCollectionConsentHelper::
394393
NewAnonymizedDataCollectionConsentHelper(
395-
IsUnifiedConsentFeatureEnabled(profile),
396394
ProfileManager::GetActiveUserProfile()->GetPrefs(),
397395
sync_service);
398396
// If they have, then allow sending of the URL.

chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "chrome/browser/profiles/profile.h"
2626
#include "chrome/browser/search_engines/template_url_service_factory.h"
2727
#include "chrome/browser/signin/signin_manager_factory.h"
28-
#include "chrome/browser/signin/unified_consent_helper.h"
2928
#include "chrome/browser/sync/profile_sync_service_factory.h"
3029
#include "chrome/browser/ui/browser.h"
3130
#include "chrome/browser/ui/browser_list.h"
@@ -92,7 +91,6 @@ ChromeAutocompleteProviderClient::ChromeAutocompleteProviderClient(
9291
url_consent_helper_(
9392
unified_consent::UrlKeyedDataCollectionConsentHelper::
9493
NewPersonalizedDataCollectionConsentHelper(
95-
IsUnifiedConsentFeatureEnabled(profile_),
9694
ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(
9795
profile_))),
9896
storage_partition_(nullptr) {}

chrome/browser/metrics/chrome_metrics_service_client.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include "chrome/browser/metrics/subprocess_metrics_provider.h"
4747
#include "chrome/browser/profiles/profile_manager.h"
4848
#include "chrome/browser/safe_browsing/certificate_reporting_metrics_provider.h"
49-
#include "chrome/browser/signin/unified_consent_helper.h"
5049
#include "chrome/browser/sync/chrome_sync_client.h"
5150
#include "chrome/browser/sync/profile_sync_service_factory.h"
5251
#include "chrome/browser/translate/translate_ranker_metrics_provider.h"
@@ -922,8 +921,7 @@ bool ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) {
922921
if (!sync) {
923922
return false;
924923
}
925-
ObserveServiceForSyncDisables(sync, profile->GetPrefs(),
926-
IsUnifiedConsentFeatureEnabled(profile));
924+
ObserveServiceForSyncDisables(sync, profile->GetPrefs());
927925
return true;
928926
}
929927

chrome/browser/metrics/ukm_browsertest.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "chrome/browser/metrics/chrome_metrics_services_manager_client.h"
1717
#include "chrome/browser/metrics/testing/metrics_reporting_pref_helper.h"
1818
#include "chrome/browser/profiles/profile_manager.h"
19-
#include "chrome/browser/signin/unified_consent_helper.h"
2019
#include "chrome/browser/sync/profile_sync_service_factory.h"
2120
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
2221
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
@@ -33,6 +32,7 @@
3332
#include "components/sync/test/fake_server/fake_server_network_resources.h"
3433
#include "components/ukm/content/source_url_recorder.h"
3534
#include "components/ukm/ukm_service.h"
35+
#include "components/unified_consent/feature.h"
3636
#include "components/unified_consent/scoped_unified_consent.h"
3737
#include "components/variations/service/variations_field_trial_creator.h"
3838
#include "components/version_info/version_info.h"
@@ -583,7 +583,7 @@ IN_PROC_BROWSER_TEST_P(UkmBrowserTest, SingleDisableHistorySyncCheck) {
583583
EXPECT_NE(0U, original_client_id);
584584

585585
harness->DisableSyncForDatatype(syncer::TYPED_URLS);
586-
if (IsUnifiedConsentFeatureEnabled(profile)) {
586+
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
587587
// Disable history sync does not disable UKM when unified consent is
588588
// enabled.
589589
EXPECT_TRUE(ukm_enabled());
@@ -621,7 +621,7 @@ IN_PROC_BROWSER_TEST_P(UkmBrowserTest, MultiDisableHistorySyncCheck) {
621621
EXPECT_EQ(original_client_id, client_id());
622622

623623
harness2->DisableSyncForDatatype(syncer::TYPED_URLS);
624-
if (IsUnifiedConsentFeatureEnabled(profile2)) {
624+
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
625625
// Disable history sync does not disable UKM when unified consent is
626626
// enabled.
627627
EXPECT_TRUE(ukm_enabled());

chrome/browser/ntp_snippets/contextual_content_suggestions_service_factory.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "chrome/browser/browser_process.h"
1414
#include "chrome/browser/profiles/profile.h"
1515
#include "chrome/browser/search/suggestions/image_decoder_impl.h"
16-
#include "chrome/browser/signin/unified_consent_helper.h"
1716
#include "chrome/browser/sync/profile_sync_service_factory.h"
1817
#include "components/image_fetcher/core/image_decoder.h"
1918
#include "components/image_fetcher/core/image_fetcher.h"
@@ -27,6 +26,7 @@
2726
#include "components/ntp_snippets/remote/cached_image_fetcher.h"
2827
#include "components/ntp_snippets/remote/remote_suggestions_database.h"
2928
#include "components/prefs/pref_service.h"
29+
#include "components/unified_consent/feature.h"
3030
#include "content/public/browser/browser_context.h"
3131
#include "content/public/browser/storage_partition.h"
3232
#include "content/public/common/service_manager_connection.h"
@@ -103,10 +103,9 @@ ContextualContentSuggestionsServiceFactory::BuildServiceInstanceFor(
103103
content::BrowserContext::GetDefaultStoragePartition(context);
104104
std::unique_ptr<unified_consent::UrlKeyedDataCollectionConsentHelper>
105105
consent_helper;
106-
if (IsUnifiedConsentFeatureEnabled(profile)) {
106+
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
107107
consent_helper = unified_consent::UrlKeyedDataCollectionConsentHelper::
108108
NewPersonalizedDataCollectionConsentHelper(
109-
true, /*is_unified_consent_enabled*/
110109
ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(
111110
profile));
112111
}

chrome/browser/signin/unified_consent_helper.cc

Lines changed: 0 additions & 23 deletions
This file was deleted.

chrome/browser/signin/unified_consent_helper.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

chrome/browser/signin/unified_consent_helper_unittest.cc

Lines changed: 0 additions & 44 deletions
This file was deleted.

chrome/browser/sync/profile_sync_service_android.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "base/strings/utf_string_conversions.h"
2121
#include "chrome/browser/browser_process.h"
2222
#include "chrome/browser/profiles/profile_manager.h"
23-
#include "chrome/browser/signin/unified_consent_helper.h"
2423
#include "chrome/browser/sync/profile_sync_service_factory.h"
2524
#include "chrome/browser/sync/sync_ui_util.h"
2625
#include "chrome/common/channel_info.h"
@@ -366,18 +365,15 @@ jboolean ProfileSyncServiceAndroid::IsUrlKeyedDataCollectionEnabled(
366365
const base::android::JavaParamRef<jobject>& obj,
367366
jboolean personalized) {
368367
DCHECK_CURRENTLY_ON(BrowserThread::UI);
369-
bool is_unified_consent_enabled = IsUnifiedConsentFeatureEnabled(profile_);
370368
std::unique_ptr<UrlKeyedDataCollectionConsentHelper>
371369
unified_consent_url_helper;
372370
if (personalized) {
373371
unified_consent_url_helper = UrlKeyedDataCollectionConsentHelper::
374-
NewPersonalizedDataCollectionConsentHelper(is_unified_consent_enabled,
375-
sync_service_);
372+
NewPersonalizedDataCollectionConsentHelper(sync_service_);
376373
} else {
377374
PrefService* pref_service = profile_->GetPrefs();
378375
unified_consent_url_helper = UrlKeyedDataCollectionConsentHelper::
379-
NewAnonymizedDataCollectionConsentHelper(is_unified_consent_enabled,
380-
pref_service, sync_service_);
376+
NewAnonymizedDataCollectionConsentHelper(pref_service, sync_service_);
381377
}
382378

383379
return unified_consent_url_helper->IsEnabled();

0 commit comments

Comments
 (0)