Commit ec002be9 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Revert "[unified-consent] Refactor migration code and add settings updates"

This reverts commit 28ac1ad7.

Reason for revert: Looks like this broke components_unittests on iOS:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/ios-simulator/36547

Original change's description:
> [unified-consent] Refactor migration code and add settings updates
> 
> The migration code in the UnifiedConsentService is refactored:
>  - The migration state IN_PROGRESS_SHOULD_SHOW_CONSENT_BUMP is
>  extracted to it's own pref kShouldShowUnifiedConsentBump.
>  - The migration state kInProgressWaitForSyncInit is introduced
>  to be able to update the settings for migration when sync is
>  initialized.
> 
> Additional changes:
>  - ShouldShowConsentBump only returns true if the consent bump
>  feature is enabled.
>  - The rollback enables sync-everything now also when the user is
>  not syncing USER_EVENTS (which is disabled during the migration).
> 
> Users that previously had the unified consent feature enabled and
> for which ShouldShowConsentBump=true, will not be shown the consent
> bump anymore after this CL is landed. This will only affect a few
> users on Canary and Dev.
> 
> Bug: 863932
> Change-Id: I211805f9059cd26056ed81d01ff19470b8caed3c
> Reviewed-on: https://chromium-review.googlesource.com/1172690
> Reviewed-by: David Roger <droger@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Commit-Queue: Thomas Tangl <tangltom@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#584341}

TBR=ellyjones@chromium.org,droger@chromium.org,tangltom@chromium.org

Change-Id: Ic50e5f7e4ac7d04be1c170b3811fd594980c71c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 863932
Reviewed-on: https://chromium-review.googlesource.com/1180682Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584350}
parent 2d67fa3c
...@@ -116,7 +116,8 @@ class ConsentBumpActivator : public BrowserListObserver, ...@@ -116,7 +116,8 @@ class ConsentBumpActivator : public BrowserListObserver,
unified_consent::UnifiedConsentService* consent_service = unified_consent::UnifiedConsentService* consent_service =
UnifiedConsentServiceFactory::GetForProfile(profile_); UnifiedConsentServiceFactory::GetForProfile(profile_);
consent_service->MarkConsentBumpShown(); consent_service->MarkMigrationComplete(
unified_consent::ConsentBumpSuppressReason::kNone);
switch (result) { switch (result) {
case LoginUIService::CONFIGURE_SYNC_FIRST: case LoginUIService::CONFIGURE_SYNC_FIRST:
......
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
namespace unified_consent { namespace unified_consent {
namespace prefs { namespace prefs {
// Boolean indicating whether all criteria is met for the consent bump to be
// shown.
const char kShouldShowUnifiedConsentBump[] =
"unified_consent.consent_bump.should_show";
// Boolean that is true when the user opted into unified consent. // Boolean that is true when the user opted into unified consent.
const char kUnifiedConsentGiven[] = "unified_consent_given"; const char kUnifiedConsentGiven[] = "unified_consent_given";
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace unified_consent { namespace unified_consent {
namespace prefs { namespace prefs {
extern const char kShouldShowUnifiedConsentBump[];
extern const char kUnifiedConsentGiven[]; extern const char kUnifiedConsentGiven[];
extern const char kUnifiedConsentMigrationState[]; extern const char kUnifiedConsentMigrationState[];
extern const char kUrlKeyedAnonymizedDataCollectionEnabled[]; extern const char kUrlKeyedAnonymizedDataCollectionEnabled[];
......
...@@ -31,10 +31,10 @@ using Service = UnifiedConsentServiceClient::Service; ...@@ -31,10 +31,10 @@ using Service = UnifiedConsentServiceClient::Service;
using ServiceState = UnifiedConsentServiceClient::ServiceState; using ServiceState = UnifiedConsentServiceClient::ServiceState;
enum class MigrationState : int { enum class MigrationState : int {
kNotInitialized = 0, NOT_INITIALIZED = 0,
kInProgressWaitForSyncInit = 1, IN_PROGRESS_SHOULD_SHOW_CONSENT_BUMP = 1,
// Reserve space for other kInProgress* entries to be added here. // Reserve space for other IN_PROGRESS_* entries to be added here.
kCompleted = 10, COMPLETED = 10,
}; };
enum class ConsentBumpSuppressReason { enum class ConsentBumpSuppressReason {
...@@ -75,14 +75,19 @@ class UnifiedConsentService : public KeyedService, ...@@ -75,14 +75,19 @@ class UnifiedConsentService : public KeyedService,
void SetUnifiedConsentGiven(bool unified_consent_given); void SetUnifiedConsentGiven(bool unified_consent_given);
bool IsUnifiedConsentGiven(); bool IsUnifiedConsentGiven();
// Returns true if all criteria is met to show the consent bump. // Helper function for the consent bump. The consent bump has to
// be shown depending on the migration state.
MigrationState GetMigrationState();
// Returns true if the consent bump needs to be shown to the user as part
// of the migration of the Chrome profile to unified consent.
bool ShouldShowConsentBump(); bool ShouldShowConsentBump();
// Marks the consent bump as shown. Any future calls to // Finishes the migration to unified consent. All future calls to
// |ShouldShowConsentBump| are guaranteed to return false. // |GetMigrationState| are guranteed to return |MIGRATION_COMPLETED|.
void MarkConsentBumpShown(); // Takes as argument the suppress reason for not showing the consent
// Records the consent bump suppress reason and updates the state whether the // bump if it wasn't shown.
// consent bump should be shown. Note: In some cases, e.g. sync paused, void MarkMigrationComplete(ConsentBumpSuppressReason suppress_reason);
// |ShouldShowConsentBump| will still return true. // Records the suppress reason for the consent bump without changing the
// migration state.
void RecordConsentBumpSuppressReason( void RecordConsentBumpSuppressReason(
ConsentBumpSuppressReason suppress_reason); ConsentBumpSuppressReason suppress_reason);
...@@ -110,17 +115,9 @@ class UnifiedConsentService : public KeyedService, ...@@ -110,17 +115,9 @@ class UnifiedConsentService : public KeyedService,
// Enables/disables syncing everything if the sync engine is initialized. // Enables/disables syncing everything if the sync engine is initialized.
void SetSyncEverythingIfPossible(bool sync_everything); void SetSyncEverythingIfPossible(bool sync_everything);
// Migration helpers. // Called when the unified consent service is created to resolve
MigrationState GetMigrationState(); // inconsistencies with sync-related prefs.
void SetMigrationState(MigrationState migration_state);
// Called when the unified consent service is created. This sets the
// |kShouldShowUnifiedConsentBump| pref to true if the user is eligible and
// calls |UpdateSettingsForMigration| at the end.
void MigrateProfileToUnifiedConsent(); void MigrateProfileToUnifiedConsent();
// Updates the settings preferences for the migration when the sync engine is
// initialized. When it is not, this function will be called again from
// |OnStateChanged| when the sync engine is initialized.
void UpdateSettingsForMigration();
// Returns true if all non-personalized services are enabled. // Returns true if all non-personalized services are enabled.
bool AreAllNonPersonalizedServicesEnabled(); bool AreAllNonPersonalizedServicesEnabled();
...@@ -128,10 +125,6 @@ class UnifiedConsentService : public KeyedService, ...@@ -128,10 +125,6 @@ class UnifiedConsentService : public KeyedService,
// Checks if all on-by-default non-personalized services are on. // Checks if all on-by-default non-personalized services are on.
bool AreAllOnByDefaultPrivacySettingsOn(); bool AreAllOnByDefaultPrivacySettingsOn();
// Helper that checks whether it's okay to call
// |SyncService::OnUserChoseDatatypes|.
bool IsSyncConfigurable();
std::unique_ptr<UnifiedConsentServiceClient> service_client_; std::unique_ptr<UnifiedConsentServiceClient> service_client_;
PrefService* pref_service_; PrefService* pref_service_;
identity::IdentityManager* identity_manager_; identity::IdentityManager* identity_manager_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment