Commit f1a2af47 authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[iOS][multiball] Move signinInteractionCoordinator to SceneController.

Reparents signinInteractionCooordinator and cleans up guts interfaces.

Note the new method in SceneControllerGuts that allows MC to cleanup
a SC before shutdown. I think this is fine at least temporarily, but
we need to iron out how this happens in iOS 12 compat in the future.

Bug: none
Change-Id: Ie214b60b830548f1aaec56207298cdf6ba6ddd3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007051
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733427}
parent f0e9bead
...@@ -228,7 +228,6 @@ source_set("app_internal") { ...@@ -228,7 +228,6 @@ source_set("app_internal") {
"//ios/chrome/browser/ui/settings", "//ios/chrome/browser/ui/settings",
"//ios/chrome/browser/ui/settings:settings_root", "//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings/google_services", "//ios/chrome/browser/ui/settings/google_services",
"//ios/chrome/browser/ui/signin_interaction",
"//ios/chrome/browser/ui/tab_grid", "//ios/chrome/browser/ui/tab_grid",
"//ios/chrome/browser/ui/tab_grid:tab_grid_ui", "//ios/chrome/browser/ui/tab_grid:tab_grid_ui",
"//ios/chrome/browser/ui/table_view", "//ios/chrome/browser/ui/table_view",
......
...@@ -123,7 +123,6 @@ ...@@ -123,7 +123,6 @@
#import "ios/chrome/browser/ui/main/scene_controller_guts.h" #import "ios/chrome/browser/ui/main/scene_controller_guts.h"
#import "ios/chrome/browser/ui/promos/signin_promo_view_controller.h" #import "ios/chrome/browser/ui/promos/signin_promo_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_coordinator.h"
#include "ios/chrome/browser/ui/tab_grid/tab_grid_coordinator.h" #include "ios/chrome/browser/ui/tab_grid/tab_grid_coordinator.h"
#import "ios/chrome/browser/ui/tab_grid/tab_switcher.h" #import "ios/chrome/browser/ui/tab_grid/tab_switcher.h"
#import "ios/chrome/browser/ui/tab_grid/view_controller_swapping.h" #import "ios/chrome/browser/ui/tab_grid/view_controller_swapping.h"
...@@ -431,7 +430,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -431,7 +430,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
@synthesize appURLLoadingService; @synthesize appURLLoadingService;
@synthesize isProcessingTabSwitcherCommand; @synthesize isProcessingTabSwitcherCommand;
@synthesize isProcessingVoiceSearchCommand; @synthesize isProcessingVoiceSearchCommand;
@synthesize signinInteractionCoordinator;
@synthesize dismissingTabSwitcher = _dismissingTabSwitcher; @synthesize dismissingTabSwitcher = _dismissingTabSwitcher;
@synthesize restoreHelper = _restoreHelper; @synthesize restoreHelper = _restoreHelper;
...@@ -756,11 +754,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -756,11 +754,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
return [[PreviousSessionInfo sharedInstance] isFirstSessionAfterUpgrade]; return [[PreviousSessionInfo sharedInstance] isFirstSessionAfterUpgrade];
} }
- (BOOL)isSettingsViewPresented {
return [self.sceneController hasSettingsNavigationController] ||
self.signinInteractionCoordinator.isSettingsViewPresented;
}
#pragma mark - StartupInformation implementation. #pragma mark - StartupInformation implementation.
- (FirstUserActionRecorder*)firstUserActionRecorder { - (FirstUserActionRecorder*)firstUserActionRecorder {
...@@ -784,9 +777,8 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -784,9 +777,8 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
} }
- (void)stopChromeMain { - (void)stopChromeMain {
// The UI should be stopped before the models they observe are stopped. // Teardown UI state that is associated with scenes.
[self.signinInteractionCoordinator cancel]; [self.sceneController teardownUI];
self.signinInteractionCoordinator = nil;
[_mainCoordinator stop]; [_mainCoordinator stop];
_mainCoordinator = nil; _mainCoordinator = nil;
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
@class BrowserViewController; @class BrowserViewController;
@class BrowserViewWrangler; @class BrowserViewWrangler;
@class HistoryCoordinator; @class HistoryCoordinator;
@class SigninInteractionCoordinator;
@class TabGridCoordinator; @class TabGridCoordinator;
@protocol BrowserInterfaceProvider; @protocol BrowserInterfaceProvider;
@protocol TabSwitcher; @protocol TabSwitcher;
...@@ -56,11 +55,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO }; ...@@ -56,11 +55,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO };
// exclusive chrome commands sent at nearly the same time. // exclusive chrome commands sent at nearly the same time.
@property(nonatomic, assign) BOOL isProcessingTabSwitcherCommand; @property(nonatomic, assign) BOOL isProcessingTabSwitcherCommand;
@property(nonatomic, assign) BOOL isProcessingVoiceSearchCommand; @property(nonatomic, assign) BOOL isProcessingVoiceSearchCommand;
// The SigninInteractionCoordinator to present Sign In UI. It is created the
// first time Sign In UI is needed to be presented and should not be destroyed
// while the UI is presented.
@property(nonatomic, strong)
SigninInteractionCoordinator* signinInteractionCoordinator;
// If YES, the tab switcher is currently active. // If YES, the tab switcher is currently active.
@property(nonatomic, assign, getter=isTabSwitcherActive) @property(nonatomic, assign, getter=isTabSwitcherActive)
...@@ -69,11 +63,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO }; ...@@ -69,11 +63,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO };
// YES while animating the dismissal of tab switcher. // YES while animating the dismissal of tab switcher.
@property(nonatomic, assign) BOOL dismissingTabSwitcher; @property(nonatomic, assign) BOOL dismissingTabSwitcher;
// Returns YES if the settings are presented, either from
// self.settingsNavigationController or from SigninInteractionCoordinator.
@property(nonatomic, assign, readonly, getter=isSettingsViewPresented)
BOOL settingsViewPresented;
// If not NONE, the current BVC should be switched to this BVC on completion // If not NONE, the current BVC should be switched to this BVC on completion
// of tab switcher dismissal. // of tab switcher dismissal.
@property(nonatomic, assign) @property(nonatomic, assign)
......
...@@ -101,6 +101,17 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -101,6 +101,17 @@ enum class EnterTabSwitcherSnapshotResult {
// A flag that keeps track of the UI initialization for the controlled scene. // A flag that keeps track of the UI initialization for the controlled scene.
@property(nonatomic, assign) BOOL hasInitializedUI; @property(nonatomic, assign) BOOL hasInitializedUI;
// The SigninInteractionCoordinator to present Sign In UI. It is created the
// first time Sign In UI is needed to be presented and should not be destroyed
// while the UI is presented.
@property(nonatomic, strong)
SigninInteractionCoordinator* signinInteractionCoordinator;
// Returns YES if the settings are presented, either from
// self.settingsNavigationController or from SigninInteractionCoordinator.
@property(nonatomic, assign, readonly, getter=isSettingsViewPresented)
BOOL settingsViewPresented;
@end @end
@implementation SceneController @implementation SceneController
...@@ -141,6 +152,11 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -141,6 +152,11 @@ enum class EnterTabSwitcherSnapshotResult {
return self.mainController.interfaceProvider; return self.mainController.interfaceProvider;
} }
- (BOOL)isSettingsViewPresented {
return self.settingsNavigationController ||
self.signinInteractionCoordinator.isSettingsViewPresented;
}
#pragma mark - SceneStateObserver #pragma mark - SceneStateObserver
- (void)sceneState:(SceneState*)sceneState - (void)sceneState:(SceneState*)sceneState
...@@ -156,10 +172,18 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -156,10 +172,18 @@ enum class EnterTabSwitcherSnapshotResult {
self.hasInitializedUI = YES; self.hasInitializedUI = YES;
} }
#pragma mark - Guts // This method completely destroys all of the UI. It should be called when the
// scene is disconnected.
- (void)teardownUI {
if (!self.hasInitializedUI) {
return; // Nothing to do.
}
// The UI should be stopped before the models they observe are stopped.
[self.signinInteractionCoordinator cancel];
self.signinInteractionCoordinator = nil;
- (BOOL)hasSettingsNavigationController { self.hasInitializedUI = NO;
return self.settingsNavigationController != nil;
} }
#pragma mark - ApplicationCommands #pragma mark - ApplicationCommands
...@@ -236,8 +260,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -236,8 +260,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove showing settings from MainController. // TODO(crbug.com/779791) : Remove showing settings from MainController.
- (void)showAutofillSettingsFromViewController: - (void)showAutofillSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) if (self.settingsNavigationController)
return; return;
...@@ -256,8 +279,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -256,8 +279,7 @@ enum class EnterTabSwitcherSnapshotResult {
// This dispatch is necessary to give enough time for the tools menu to // This dispatch is necessary to give enough time for the tools menu to
// disappear before taking a screenshot. // disappear before taking a screenshot.
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) if (self.settingsNavigationController)
return; return;
Browser* browser = self.mainInterface.browser; Browser* browser = self.mainInterface.browser;
...@@ -289,29 +311,27 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -289,29 +311,27 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Do not pass |baseViewController| through dispatcher. // TODO(crbug.com/779791) : Do not pass |baseViewController| through dispatcher.
- (void)showSignin:(ShowSigninCommand*)command - (void)showSignin:(ShowSigninCommand*)command
baseViewController:(UIViewController*)baseViewController { baseViewController:(UIViewController*)baseViewController {
if (!self.mainController.signinInteractionCoordinator) { if (!self.signinInteractionCoordinator) {
Browser* mainBrowser = self.mainInterface.browser; Browser* mainBrowser = self.mainInterface.browser;
self.mainController.signinInteractionCoordinator = self.signinInteractionCoordinator = [[SigninInteractionCoordinator alloc]
[[SigninInteractionCoordinator alloc] initWithBrowser:mainBrowser
initWithBrowser:mainBrowser dispatcher:self.mainController.mainBVC.dispatcher];
dispatcher:self.mainController.mainBVC.dispatcher];
} }
switch (command.operation) { switch (command.operation) {
case AUTHENTICATION_OPERATION_REAUTHENTICATE: case AUTHENTICATION_OPERATION_REAUTHENTICATE:
[self.mainController.signinInteractionCoordinator [self.signinInteractionCoordinator
reAuthenticateWithAccessPoint:command.accessPoint reAuthenticateWithAccessPoint:command.accessPoint
promoAction:command.promoAction promoAction:command.promoAction
presentingViewController:baseViewController presentingViewController:baseViewController
completion:command.callback]; completion:command.callback];
break; break;
case AUTHENTICATION_OPERATION_SIGNIN: case AUTHENTICATION_OPERATION_SIGNIN:
[self.mainController.signinInteractionCoordinator [self.signinInteractionCoordinator signInWithIdentity:command.identity
signInWithIdentity:command.identity accessPoint:command.accessPoint
accessPoint:command.accessPoint promoAction:command.promoAction
promoAction:command.promoAction presentingViewController:baseViewController
presentingViewController:baseViewController completion:command.callback];
completion:command.callback];
break; break;
} }
} }
...@@ -319,11 +339,10 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -319,11 +339,10 @@ enum class EnterTabSwitcherSnapshotResult {
- (void)showAdvancedSigninSettingsFromViewController: - (void)showAdvancedSigninSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
Browser* mainBrowser = self.mainInterface.browser; Browser* mainBrowser = self.mainInterface.browser;
self.mainController.signinInteractionCoordinator = self.signinInteractionCoordinator = [[SigninInteractionCoordinator alloc]
[[SigninInteractionCoordinator alloc] initWithBrowser:mainBrowser
initWithBrowser:mainBrowser dispatcher:self.mainController.mainBVC.dispatcher];
dispatcher:self.mainController.mainBVC.dispatcher]; [self.signinInteractionCoordinator
[self.mainController.signinInteractionCoordinator
showAdvancedSigninSettingsWithPresentingViewController: showAdvancedSigninSettingsWithPresentingViewController:
baseViewController]; baseViewController];
} }
...@@ -331,14 +350,13 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -331,14 +350,13 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove settings commands from MainController. // TODO(crbug.com/779791) : Remove settings commands from MainController.
- (void)showAddAccountFromViewController:(UIViewController*)baseViewController { - (void)showAddAccountFromViewController:(UIViewController*)baseViewController {
Browser* mainBrowser = self.mainInterface.browser; Browser* mainBrowser = self.mainInterface.browser;
if (!self.mainController.signinInteractionCoordinator) { if (!self.signinInteractionCoordinator) {
self.mainController.signinInteractionCoordinator = self.signinInteractionCoordinator = [[SigninInteractionCoordinator alloc]
[[SigninInteractionCoordinator alloc] initWithBrowser:mainBrowser
initWithBrowser:mainBrowser dispatcher:self.mainController.mainBVC.dispatcher];
dispatcher:self.mainController.mainBVC.dispatcher];
} }
[self.mainController.signinInteractionCoordinator [self.signinInteractionCoordinator
addAccountWithAccessPoint:signin_metrics::AccessPoint:: addAccountWithAccessPoint:signin_metrics::AccessPoint::
ACCESS_POINT_UNKNOWN ACCESS_POINT_UNKNOWN
promoAction:signin_metrics::PromoAction:: promoAction:signin_metrics::PromoAction::
...@@ -364,8 +382,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -364,8 +382,7 @@ enum class EnterTabSwitcherSnapshotResult {
} }
- (void)showSettingsFromViewController:(UIViewController*)baseViewController { - (void)showSettingsFromViewController:(UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) if (self.settingsNavigationController)
return; return;
[[DeferredInitializationRunner sharedInstance] [[DeferredInitializationRunner sharedInstance]
...@@ -386,8 +403,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -386,8 +403,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove show settings from MainController. // TODO(crbug.com/779791) : Remove show settings from MainController.
- (void)showAccountsSettingsFromViewController: - (void)showAccountsSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (!baseViewController) { if (!baseViewController) {
DCHECK_EQ(self.mainController.currentBVC, DCHECK_EQ(self.mainController.currentBVC,
self.mainController.mainCoordinator.activeViewController); self.mainController.mainCoordinator.activeViewController);
...@@ -416,8 +432,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -416,8 +432,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove Google services settings from MainController. // TODO(crbug.com/779791) : Remove Google services settings from MainController.
- (void)showGoogleServicesSettingsFromViewController: - (void)showGoogleServicesSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (!baseViewController) { if (!baseViewController) {
DCHECK_EQ(self.mainController.currentBVC, DCHECK_EQ(self.mainController.currentBVC,
self.mainController.mainCoordinator.activeViewController); self.mainController.mainCoordinator.activeViewController);
...@@ -445,8 +460,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -445,8 +460,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove show settings commands from MainController. // TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showSyncPassphraseSettingsFromViewController: - (void)showSyncPassphraseSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) { if (self.settingsNavigationController) {
[self.settingsNavigationController [self.settingsNavigationController
showSyncPassphraseSettingsFromViewController:baseViewController]; showSyncPassphraseSettingsFromViewController:baseViewController];
...@@ -465,8 +479,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -465,8 +479,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove show settings commands from MainController. // TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showSavedPasswordsSettingsFromViewController: - (void)showSavedPasswordsSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) { if (self.settingsNavigationController) {
[self.settingsNavigationController [self.settingsNavigationController
showSavedPasswordsSettingsFromViewController:baseViewController]; showSavedPasswordsSettingsFromViewController:baseViewController];
...@@ -484,8 +497,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -484,8 +497,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove show settings commands from MainController. // TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showProfileSettingsFromViewController: - (void)showProfileSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) { if (self.settingsNavigationController) {
[self.settingsNavigationController [self.settingsNavigationController
showProfileSettingsFromViewController:baseViewController]; showProfileSettingsFromViewController:baseViewController];
...@@ -504,8 +516,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -504,8 +516,7 @@ enum class EnterTabSwitcherSnapshotResult {
// TODO(crbug.com/779791) : Remove show settings commands from MainController. // TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showCreditCardSettingsFromViewController: - (void)showCreditCardSettingsFromViewController:
(UIViewController*)baseViewController { (UIViewController*)baseViewController {
DCHECK(!self.mainController.signinInteractionCoordinator DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
.isSettingsViewPresented);
if (self.settingsNavigationController) { if (self.settingsNavigationController) {
[self.settingsNavigationController [self.settingsNavigationController
showCreditCardSettingsFromViewController:baseViewController]; showCreditCardSettingsFromViewController:baseViewController];
...@@ -858,7 +869,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -858,7 +869,7 @@ enum class EnterTabSwitcherSnapshotResult {
ProceduralBlock completionWithBVC = ^{ ProceduralBlock completionWithBVC = ^{
DCHECK(self.mainController.currentBVC); DCHECK(self.mainController.currentBVC);
DCHECK(!self.mainController.tabSwitcherIsActive); DCHECK(!self.mainController.tabSwitcherIsActive);
DCHECK(!self.mainController.signinInteractionCoordinator.isActive); DCHECK(!self.signinInteractionCoordinator.isActive);
// This will dismiss the SSO view controller. // This will dismiss the SSO view controller.
[self.interfaceProvider.currentInterface [self.interfaceProvider.currentInterface
clearPresentedStateWithCompletion:completion clearPresentedStateWithCompletion:completion
...@@ -869,7 +880,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -869,7 +880,7 @@ enum class EnterTabSwitcherSnapshotResult {
// active. // active.
DCHECK(self.mainController.tabSwitcherIsActive); DCHECK(self.mainController.tabSwitcherIsActive);
// This will dismiss the SSO view controller. // This will dismiss the SSO view controller.
[self.mainController.signinInteractionCoordinator cancelAndDismiss]; [self.signinInteractionCoordinator cancelAndDismiss];
// History coordinator can be started on top of the tab grid. This is not // History coordinator can be started on top of the tab grid. This is not
// true of the other tab switchers. // true of the other tab switchers.
DCHECK(self.mainController.mainCoordinator); DCHECK(self.mainController.mainCoordinator);
...@@ -881,18 +892,18 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -881,18 +892,18 @@ enum class EnterTabSwitcherSnapshotResult {
// dismissed. Then, based on whether the BVC is present or not, a different // dismissed. Then, based on whether the BVC is present or not, a different
// completion callback is called. // completion callback is called.
if (!self.mainController.tabSwitcherIsActive && if (!self.mainController.tabSwitcherIsActive &&
self.mainController.isSettingsViewPresented) { self.isSettingsViewPresented) {
// In this case, the settings are up and the BVC is showing. Close the // In this case, the settings are up and the BVC is showing. Close the
// settings then call the BVC completion. // settings then call the BVC completion.
[self closeSettingsAnimated:NO completion:completionWithBVC]; [self closeSettingsAnimated:NO completion:completionWithBVC];
} else if (self.mainController.isSettingsViewPresented) { } else if (self.isSettingsViewPresented) {
// In this case, the settings are up but the BVC is not showing. Close the // In this case, the settings are up but the BVC is not showing. Close the
// settings then call the no-BVC completion. // settings then call the no-BVC completion.
[self closeSettingsAnimated:NO completion:completionWithoutBVC]; [self closeSettingsAnimated:NO completion:completionWithoutBVC];
} else if (![self.mainController isTabSwitcherActive]) { } else if (![self.mainController isTabSwitcherActive]) {
// In this case, the settings are not shown but the BVC is showing. Call the // In this case, the settings are not shown but the BVC is showing. Call the
// BVC completion. // BVC completion.
[self.mainController.signinInteractionCoordinator cancel]; [self.signinInteractionCoordinator cancel];
completionWithBVC(); completionWithBVC();
} else { } else {
// In this case, neither the settings nor the BVC are shown. Call the no-BVC // In this case, neither the settings nor the BVC are shown. Call the no-BVC
...@@ -1143,9 +1154,8 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -1143,9 +1154,8 @@ enum class EnterTabSwitcherSnapshotResult {
// - start sign-in // - start sign-in
// - tap on "Settings" to open the advanced sign-in settings // - tap on "Settings" to open the advanced sign-in settings
// - tap on "Manage Your Google Account" // - tap on "Manage Your Google Account"
DCHECK( DCHECK(self.signinInteractionCoordinator.isSettingsViewPresented);
self.mainController.signinInteractionCoordinator.isSettingsViewPresented); [self.signinInteractionCoordinator
[self.mainController.signinInteractionCoordinator
abortAndDismissSettingsViewAnimated:animated abortAndDismissSettingsViewAnimated:animated
completion:completion]; completion:completion];
} }
......
...@@ -60,15 +60,18 @@ class ChromeBrowserState; ...@@ -60,15 +60,18 @@ class ChromeBrowserState;
- (void)presentSignedInAccountsViewControllerForBrowserState: - (void)presentSignedInAccountsViewControllerForBrowserState:
(ios::ChromeBrowserState*)browserState; (ios::ChromeBrowserState*)browserState;
// Returns YES if the settings navigation controller exists.
- (BOOL)hasSettingsNavigationController;
// Clears incognito data that is specific to iOS and won't be cleared by // Clears incognito data that is specific to iOS and won't be cleared by
// deleting the browser state. // deleting the browser state.
- (void)clearIOSSpecificIncognitoData; - (void)clearIOSSpecificIncognitoData;
- (void)activateBVCAndMakeCurrentBVCPrimary; - (void)activateBVCAndMakeCurrentBVCPrimary;
#pragma mark - iOS 12 compat
// Method called on SceneController when the scene disconnects. Exposed here for
// iOS 12 compatibility.
- (void)teardownUI;
@end @end
#endif // IOS_CHROME_BROWSER_UI_MAIN_SCENE_CONTROLLER_GUTS_H_ #endif // IOS_CHROME_BROWSER_UI_MAIN_SCENE_CONTROLLER_GUTS_H_
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