Commit 2a0239a8 authored by Nazerke's avatar Nazerke Committed by Commit Bot

[iOS][coordinator] Modernize Unified Consent Coordinator.

This CL modernizes the UnifiedConsentCoordinator to use |browser| in
the initializer. This CL includes migration to ChromeCoordinator as a
superclass.

Bug: 1029346, 1048685
Change-Id: Ie2ce333091fcfcc9ed37fef74b2d71b254105f52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2068597Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
Cr-Commit-Position: refs/heads/master@{#743898}
parent b4ac4494
......@@ -692,7 +692,9 @@ enum AuthenticationState {
// The user can refuse to sign-in into a managed account, so the state
// returns to "IdentityPicker". In that case, there is no need to create a
// new UnifiedConsentCoordinator. The current one should be used.
_unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc] init];
_unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc]
initWithBaseViewController:nil
browser:self.browser];
_unifiedConsentCoordinator.delegate = self;
if (_selectedIdentity)
_unifiedConsentCoordinator.selectedIdentity = _selectedIdentity;
......
......@@ -59,7 +59,9 @@ using signin_metrics::PromoAction;
self.viewController = [[UserSigninViewController alloc] init];
self.viewController.delegate = self;
self.unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc] init];
self.unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc]
initWithBaseViewController:nil
browser:self.browser];
self.unifiedConsentCoordinator.delegate = self;
// Set UnifiedConsentCoordinator properties.
......
......@@ -16,8 +16,10 @@ source_set("unified_consent") {
":unified_consent_ui",
"//base",
"//ios/chrome/browser",
"//ios/chrome/browser/main:public",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/public/provider/chrome/browser/signin",
]
}
......
......@@ -5,7 +5,7 @@
#ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_UNIFIED_CONSENT_UNIFIED_CONSENT_COORDINATOR_H_
#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_UNIFIED_CONSENT_UNIFIED_CONSENT_COORDINATOR_H_
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
#include <vector>
......@@ -42,7 +42,15 @@
// All the string ids displayed by the view are available with
// |consentStringIds| and |openSettingsStringId|. Those can be used to record
// the consent agreed by the user.
@interface UnifiedConsentCoordinator : NSObject
@interface UnifiedConsentCoordinator : ChromeCoordinator
// Unavailable, use -initWithBaseViewController:browser:.
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
NS_UNAVAILABLE;
// Unavailable, use -initWithBaseViewController:browser:.
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
browserState:(ChromeBrowserState*)browserState
NS_UNAVAILABLE;
@property(nonatomic, weak) id<UnifiedConsentCoordinatorDelegate> delegate;
// Identity selected by the user to sign-in. By default, the first identity from
......@@ -66,9 +74,6 @@
// ChromeSigninViewController.
@property(nonatomic, assign, getter=isUIDisabled) BOOL uiDisabled;
// Starts this coordinator.
- (void)start;
// List of string ids used for the user consent. The string ids order matches
// the way they appear on the screen.
- (const std::vector<int>&)consentStringIds;
......
......@@ -5,6 +5,7 @@
#include "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_coordinator.h"
#include "base/logging.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator_delegate.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_mediator.h"
......@@ -34,8 +35,9 @@
@implementation UnifiedConsentCoordinator
- (instancetype)init {
self = [super init];
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
browser:(Browser*)browser {
self = [super initWithBaseViewController:nil browser:browser];
if (self) {
_unifiedConsentViewController = [[UnifiedConsentViewController alloc] init];
_unifiedConsentViewController.delegate = self;
......
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