Commit c53e5343 authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

Revert "[iOS] Using UnifiedConsentService::SetUnifiedConsentGiven() in the settings"

This reverts commit 72bd9335.

Reason for revert: breaks test.

Original change's description:
> [iOS] Using UnifiedConsentService::SetUnifiedConsentGiven() in the settings
> 
> This CL enables unified consent given when the user signs in to Chrome.
> This CL also disabled and enables unified consent given when the user
> toggles the corresponding switch on and off in the Sync and other services
> settings screen.
> 
> Bug: 827072
> Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
> Change-Id: I5384052f4abe117e7816733e45dc4091afe55708
> Reviewed-on: https://chromium-review.googlesource.com/1165151
> Reviewed-by: Thomas Tangl <tangltom@chromium.org>
> Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
> Reviewed-by: Sergio Collazos <sczs@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#581873}

TBR=msarda@chromium.org,jlebel@chromium.org,sczs@chromium.org,tangltom@chromium.org

Change-Id: I057d4085ebfb55e08e7a06d7e0cc0fbdedfaf36c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 827072
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Reviewed-on: https://chromium-review.googlesource.com/1170003Reviewed-by: default avatarAndrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581907}
parent 0848f4fb
...@@ -42,7 +42,6 @@ source_set("authentication") { ...@@ -42,7 +42,6 @@ source_set("authentication") {
"//components/signin/core/browser", "//components/signin/core/browser",
"//components/signin/ios/browser", "//components/signin/ios/browser",
"//components/strings", "//components/strings",
"//components/unified_consent",
"//google_apis", "//google_apis",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser", "//ios/chrome/browser",
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "components/signin/core/browser/profile_management_switches.h" #include "components/signin/core/browser/profile_management_switches.h"
#include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/signin_metrics.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/unified_consent/unified_consent_service.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/signin/account_tracker_service_factory.h" #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
...@@ -46,7 +45,6 @@ ...@@ -46,7 +45,6 @@
#import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/browser/ui/util/label_link_controller.h" #import "ios/chrome/browser/ui/util/label_link_controller.h"
#include "ios/chrome/browser/unified_consent/feature.h" #include "ios/chrome/browser/unified_consent/feature.h"
#include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h"
#include "ios/chrome/common/string_util.h" #include "ios/chrome/common/string_util.h"
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
...@@ -298,14 +296,6 @@ enum AuthenticationState { ...@@ -298,14 +296,6 @@ enum AuthenticationState {
- (void)acceptSignInAndCommitSyncChanges { - (void)acceptSignInAndCommitSyncChanges {
DCHECK(_didSignIn); DCHECK(_didSignIn);
if (_unifiedConsentEnabled) {
// The consent has to be given as soon as the user is signed in. Even when
// they open the settings through the link.
unified_consent::UnifiedConsentService* unifiedConsentService =
UnifiedConsentServiceFactory::GetForBrowserState(_browserState);
DCHECK(unifiedConsentService);
unifiedConsentService->SetUnifiedConsentGiven(true);
}
SyncSetupServiceFactory::GetForBrowserState(_browserState)->CommitChanges(); SyncSetupServiceFactory::GetForBrowserState(_browserState)->CommitChanges();
[self acceptSignInAndShowAccountsSettings:_unifiedConsentCoordinator [self acceptSignInAndShowAccountsSettings:_unifiedConsentCoordinator
.settingsLinkWasTapped]; .settingsLinkWasTapped];
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h" #import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_mediator.h" #import "ios/chrome/browser/ui/settings/google_services_settings_mediator.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_view_controller.h" #import "ios/chrome/browser/ui/settings/google_services_settings_view_controller.h"
#include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -51,13 +50,10 @@ ...@@ -51,13 +50,10 @@
SyncSetupServiceFactory::GetForBrowserState(self.browserState); SyncSetupServiceFactory::GetForBrowserState(self.browserState);
browser_sync::ProfileSyncService* syncService = browser_sync::ProfileSyncService* syncService =
ProfileSyncServiceFactory::GetForBrowserState(self.browserState); ProfileSyncServiceFactory::GetForBrowserState(self.browserState);
unified_consent::UnifiedConsentService* unifiedConsentService =
UnifiedConsentServiceFactory::GetForBrowserState(self.browserState);
self.mediator = [[GoogleServicesSettingsMediator alloc] self.mediator = [[GoogleServicesSettingsMediator alloc]
initWithPrefService:self.browserState->GetPrefs() initWithPrefService:self.browserState->GetPrefs()
syncService:syncService syncService:syncService
syncSetupService:syncSetupService syncSetupService:syncSetupService];
unifiedConsentService:unifiedConsentService];
self.mediator.consumer = viewController; self.mediator.consumer = viewController;
self.mediator.authService = self.mediator.authService =
AuthenticationServiceFactory::GetForBrowserState(self.browserState); AuthenticationServiceFactory::GetForBrowserState(self.browserState);
......
...@@ -98,8 +98,7 @@ using unified_consent::prefs::kUnifiedConsentGiven; ...@@ -98,8 +98,7 @@ using unified_consent::prefs::kUnifiedConsentGiven;
EARL_GREY_TEST_SKIPPED(@"This test is UIRefresh only."); EARL_GREY_TEST_SKIPPED(@"This test is UIRefresh only.");
[SigninEarlGreyUI signinWithIdentity:[SigninEarlGreyUtils fakeIdentity1]]; [SigninEarlGreyUI signinWithIdentity:[SigninEarlGreyUtils fakeIdentity1]];
PrefService* prefService = GetOriginalBrowserState()->GetPrefs(); PrefService* prefService = GetOriginalBrowserState()->GetPrefs();
GREYAssert(prefService->GetBoolean(kUnifiedConsentGiven), prefService->SetBoolean(kUnifiedConsentGiven, true);
@"Unified consent should be given");
[self openGoogleServicesSettings]; [self openGoogleServicesSettings];
[self assertSyncEverythingSection]; [self assertSyncEverythingSection];
[self assertPersonalizedServicesCollapsed:YES]; [self assertPersonalizedServicesCollapsed:YES];
......
...@@ -20,9 +20,6 @@ class SyncSetupService; ...@@ -20,9 +20,6 @@ class SyncSetupService;
namespace browser_sync { namespace browser_sync {
class ProfileSyncService; class ProfileSyncService;
}; };
namespace unified_consent {
class UnifiedConsentService;
} // namespace unified_consent
// Mediator for the Google services settings. // Mediator for the Google services settings.
@interface GoogleServicesSettingsMediator @interface GoogleServicesSettingsMediator
...@@ -40,8 +37,6 @@ class UnifiedConsentService; ...@@ -40,8 +37,6 @@ class UnifiedConsentService;
syncService: syncService:
(browser_sync::ProfileSyncService*)syncService (browser_sync::ProfileSyncService*)syncService
syncSetupService:(SyncSetupService*)syncSetupService syncSetupService:(SyncSetupService*)syncSetupService
unifiedConsentService:
(unified_consent::UnifiedConsentService*)unifiedConsentService
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/unified_consent/pref_names.h" #include "components/unified_consent/pref_names.h"
#include "components/unified_consent/unified_consent_service.h"
#import "ios/chrome/browser/signin/authentication_service.h" #import "ios/chrome/browser/signin/authentication_service.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/authentication_service_factory.h"
#include "ios/chrome/browser/sync/sync_observer_bridge.h" #include "ios/chrome/browser/sync/sync_observer_bridge.h"
...@@ -85,9 +84,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -85,9 +84,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
std::unique_ptr<SyncObserverBridge> _syncObserver; std::unique_ptr<SyncObserverBridge> _syncObserver;
} }
// Unified consent service.
@property(nonatomic, assign)
unified_consent::UnifiedConsentService* unifiedConsentService;
// Returns YES if the user is authenticated. // Returns YES if the user is authenticated.
@property(nonatomic, assign, readonly) BOOL isAuthenticated; @property(nonatomic, assign, readonly) BOOL isAuthenticated;
// Returns YES if the user has given his consent to use Google services. // Returns YES if the user has given his consent to use Google services.
...@@ -120,7 +116,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -120,7 +116,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
@implementation GoogleServicesSettingsMediator @implementation GoogleServicesSettingsMediator
@synthesize unifiedConsentService = _unifiedConsentService;
@synthesize consumer = _consumer; @synthesize consumer = _consumer;
@synthesize authService = _authService; @synthesize authService = _authService;
@synthesize prefService = _prefService; @synthesize prefService = _prefService;
...@@ -137,21 +132,17 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -137,21 +132,17 @@ typedef NS_ENUM(NSInteger, ItemType) {
#pragma mark - Load model #pragma mark - Load model
- (instancetype) - (instancetype)initWithPrefService:(PrefService*)prefService
initWithPrefService:(PrefService*)prefService syncService:
syncService:(browser_sync::ProfileSyncService*)syncService (browser_sync::ProfileSyncService*)syncService
syncSetupService:(SyncSetupService*)syncSetupService syncSetupService:(SyncSetupService*)syncSetupService {
unifiedConsentService:
(unified_consent::UnifiedConsentService*)unifiedConsentService {
self = [super init]; self = [super init];
if (self) { if (self) {
DCHECK(prefService); DCHECK(prefService);
DCHECK(syncService); DCHECK(syncService);
DCHECK(syncSetupService); DCHECK(syncSetupService);
DCHECK(unifiedConsentService);
_prefService = prefService; _prefService = prefService;
_syncSetupService = syncSetupService; _syncSetupService = syncSetupService;
_unifiedConsentService = unifiedConsentService;
_syncObserver.reset(new SyncObserverBridge(self, syncService)); _syncObserver.reset(new SyncObserverBridge(self, syncService));
prefObserverBridge_ = std::make_unique<PrefObserverBridge>(self); prefObserverBridge_ = std::make_unique<PrefObserverBridge>(self);
prefChangeRegistrar_.Init(prefService); prefChangeRegistrar_.Init(prefService);
...@@ -216,7 +207,7 @@ unifiedConsentService: ...@@ -216,7 +207,7 @@ unifiedConsentService:
} }
- (BOOL)isConsentGiven { - (BOOL)isConsentGiven {
return self.unifiedConsentService->IsUnifiedConsentGiven(); return self.prefService->GetBoolean(kUnifiedConsentGiven);
} }
- (CollectionViewItem*)syncEverythingItem { - (CollectionViewItem*)syncEverythingItem {
...@@ -512,7 +503,7 @@ textItemWithItemType:(NSInteger)itemType ...@@ -512,7 +503,7 @@ textItemWithItemType:(NSInteger)itemType
return; return;
// Mark the switch has being animated to avoid being reloaded. // Mark the switch has being animated to avoid being reloaded.
base::AutoReset<BOOL> autoReset(&_syncEverythingSwitchBeingAnimated, YES); base::AutoReset<BOOL> autoReset(&_syncEverythingSwitchBeingAnimated, YES);
self.unifiedConsentService->SetUnifiedConsentGiven(value); self.prefService->SetBoolean(kUnifiedConsentGiven, value);
} }
- (void)toggleSyncDataSync:(NSInteger)dataTypeInt withValue:(BOOL)value { - (void)toggleSyncDataSync:(NSInteger)dataTypeInt withValue:(BOOL)value {
......
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