Commit 45f59631 authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[multiball] Show account selector when a scene becomes active.

Instead of using deferred initialization, show the account selector when
a scene becomes active. This means if there are multiple scenes, the
user will always have to go through this dialog even if they switch to
another window.
Also completely get rid of AppNavigation, as it's not used anymore.

Bug: 1045663
Change-Id: Idbbd19f1e188b033e39ce318def6b1338ad3ac6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107581
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751982}
parent 900d2515
...@@ -86,7 +86,6 @@ source_set("unit_tests") { ...@@ -86,7 +86,6 @@ source_set("unit_tests") {
source_set("application_delegate_internal") { source_set("application_delegate_internal") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"app_navigation.h",
"app_state.h", "app_state.h",
"app_state.mm", "app_state.mm",
"browser_launcher.h", "browser_launcher.h",
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_APP_APPLICATION_DELEGATE_APP_NAVIGATION_H_
#define IOS_CHROME_APP_APPLICATION_DELEGATE_APP_NAVIGATION_H_
#import <Foundation/Foundation.h>
#include "base/ios/block_types.h"
class ChromeBrowserState;
@class SettingsNavigationController;
// Handles the navigation through the application.
@protocol AppNavigation<NSObject>
// Presents a SignedInAccountsViewController for |browserState| on the top view
// controller.
- (void)presentSignedInAccountsViewControllerForBrowserState:
(ChromeBrowserState*)browserState;
@end
#endif // IOS_CHROME_APP_APPLICATION_DELEGATE_APP_NAVIGATION_H_
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@protocol AppNavigation;
@protocol BrowserLauncher; @protocol BrowserLauncher;
@class MainApplicationDelegate; @class MainApplicationDelegate;
@class MemoryWarningHelper; @class MemoryWarningHelper;
...@@ -54,8 +53,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher ...@@ -54,8 +53,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
// Called when the application is getting terminated. It stops all outgoing // Called when the application is getting terminated. It stops all outgoing
// requests, config updates, clears the device sharing manager and stops the // requests, config updates, clears the device sharing manager and stops the
// mainChrome instance. // mainChrome instance.
- (void)applicationWillTerminate:(UIApplication*)application - (void)applicationWillTerminate:(UIApplication*)application;
applicationNavigation:(id<AppNavigation>)appNavigation;
// Resumes the session: reinitializing metrics and opening new tab if necessary. // Resumes the session: reinitializing metrics and opening new tab if necessary.
// User sessions are defined in terms of BecomeActive/ResignActive so that // User sessions are defined in terms of BecomeActive/ResignActive so that
...@@ -75,8 +73,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher ...@@ -75,8 +73,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
- (void)applicationWillEnterForeground:(UIApplication*)application - (void)applicationWillEnterForeground:(UIApplication*)application
metricsMediator:(MetricsMediator*)metricsMediator metricsMediator:(MetricsMediator*)metricsMediator
memoryHelper:(MemoryWarningHelper*)memoryHelper memoryHelper:(MemoryWarningHelper*)memoryHelper
tabOpener:(id<TabOpening>)tabOpener tabOpener:(id<TabOpening>)tabOpener;
appNavigation:(id<AppNavigation>)appNavigation;
// Sets the return value for -didFinishLaunchingWithOptions that determines if // Sets the return value for -didFinishLaunchingWithOptions that determines if
// UIKit should make followup delegate calls such as // UIKit should make followup delegate calls such as
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "components/feature_engagement/public/event_constants.h" #include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/tracker.h" #include "components/feature_engagement/public/tracker.h"
#include "components/metrics/metrics_service.h" #include "components/metrics/metrics_service.h"
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/browser_launcher.h" #import "ios/chrome/app/application_delegate/browser_launcher.h"
#import "ios/chrome/app/application_delegate/memory_warning_helper.h" #import "ios/chrome/app/application_delegate/memory_warning_helper.h"
#import "ios/chrome/app/application_delegate/metrics_mediator.h" #import "ios/chrome/app/application_delegate/metrics_mediator.h"
...@@ -271,8 +270,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher ...@@ -271,8 +270,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
- (void)applicationWillEnterForeground:(UIApplication*)application - (void)applicationWillEnterForeground:(UIApplication*)application
metricsMediator:(MetricsMediator*)metricsMediator metricsMediator:(MetricsMediator*)metricsMediator
memoryHelper:(MemoryWarningHelper*)memoryHelper memoryHelper:(MemoryWarningHelper*)memoryHelper
tabOpener:(id<TabOpening>)tabOpener tabOpener:(id<TabOpening>)tabOpener {
appNavigation:(id<AppNavigation>)appNavigation {
if ([_browserLauncher browserInitializationStage] < if ([_browserLauncher browserInitializationStage] <
INITIALIZATION_STAGE_FOREGROUND) { INITIALIZATION_STAGE_FOREGROUND) {
// The application has been launched in background and the initialization // The application has been launched in background and the initialization
...@@ -311,20 +309,14 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher ...@@ -311,20 +309,14 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
.interfaceProvider]; .interfaceProvider];
[memoryHelper resetForegroundMemoryWarningCount]; [memoryHelper resetForegroundMemoryWarningCount];
ChromeBrowserState* currentBrowserState =
_browserLauncher.interfaceProvider.currentInterface.browserState;
if ([SignedInAccountsViewController
shouldBePresentedForBrowserState:currentBrowserState]) {
[appNavigation presentSignedInAccountsViewControllerForBrowserState:
currentBrowserState];
}
// Use the mainBVC as the ContentSuggestions can only be started in non-OTR. // Use the mainBVC as the ContentSuggestions can only be started in non-OTR.
ChromeBrowserState* mainBrowserState = ChromeBrowserState* mainBrowserState =
_browserLauncher.interfaceProvider.mainInterface.browserState; _browserLauncher.interfaceProvider.mainInterface.browserState;
[ContentSuggestionsSchedulerNotifications notifyForeground:mainBrowserState]; [ContentSuggestionsSchedulerNotifications notifyForeground:mainBrowserState];
// If the current browser state is not OTR, check for cookie loss. // If the current browser state is not OTR, check for cookie loss.
ChromeBrowserState* currentBrowserState =
_browserLauncher.interfaceProvider.currentInterface.browserState;
if (currentBrowserState && !currentBrowserState->IsOffTheRecord() && if (currentBrowserState && !currentBrowserState->IsOffTheRecord() &&
currentBrowserState->GetOriginalChromeBrowserState() currentBrowserState->GetOriginalChromeBrowserState()
->GetStatePath() ->GetStatePath()
...@@ -389,8 +381,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher ...@@ -389,8 +381,7 @@ initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
[MetricsMediator logStartupDuration:_startupInformation]; [MetricsMediator logStartupDuration:_startupInformation];
} }
- (void)applicationWillTerminate:(UIApplication*)application - (void)applicationWillTerminate:(UIApplication*)application {
applicationNavigation:(id<AppNavigation>)appNavigation {
if (_appIsTerminating) { if (_appIsTerminating) {
// Previous handling of this method spun the runloop, resulting in // Previous handling of this method spun the runloop, resulting in
// recursive calls; this does not appear to happen with the new shutdown // recursive calls; this does not appear to happen with the new shutdown
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/ios/block_types.h" #include "base/ios/block_types.h"
#import "ios/chrome/app/app_startup_parameters.h" #import "ios/chrome/app/app_startup_parameters.h"
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/app_state_testing.h" #import "ios/chrome/app/application_delegate/app_state_testing.h"
#import "ios/chrome/app/application_delegate/browser_launcher.h" #import "ios/chrome/app/application_delegate/browser_launcher.h"
#import "ios/chrome/app/application_delegate/fake_startup_information.h" #import "ios/chrome/app/application_delegate/fake_startup_information.h"
...@@ -261,7 +260,6 @@ class AppStateTest : public BlockCleanupTest { ...@@ -261,7 +260,6 @@ class AppStateTest : public BlockCleanupTest {
id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]]; id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]];
id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]]; id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]];
id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)]; id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
id tabModel = interface_provider_.currentInterface.tabModel; id tabModel = interface_provider_.currentInterface.tabModel;
[[metricsMediator stub] updateMetricsStateBasedOnPrefsUserTriggered:NO]; [[metricsMediator stub] updateMetricsStateBasedOnPrefsUserTriggered:NO];
...@@ -281,8 +279,7 @@ class AppStateTest : public BlockCleanupTest { ...@@ -281,8 +279,7 @@ class AppStateTest : public BlockCleanupTest {
[appState applicationWillEnterForeground:application [appState applicationWillEnterForeground:application
metricsMediator:metricsMediator metricsMediator:metricsMediator
memoryHelper:memoryHelper memoryHelper:memoryHelper
tabOpener:tabOpener tabOpener:tabOpener];
appNavigation:appNavigation];
initializeIncognitoBlocker(window); initializeIncognitoBlocker(window);
...@@ -536,8 +533,6 @@ TEST_F(AppStateWithThreadTest, willTerminate) { ...@@ -536,8 +533,6 @@ TEST_F(AppStateWithThreadTest, willTerminate) {
browserInitializationStage]; browserInitializationStage];
[[[browserLauncher stub] andReturn:interfaceProvider] interfaceProvider]; [[[browserLauncher stub] andReturn:interfaceProvider] interfaceProvider];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
id startupInformation = id startupInformation =
[OCMockObject mockForProtocol:@protocol(StartupInformation)]; [OCMockObject mockForProtocol:@protocol(StartupInformation)];
[[startupInformation expect] stopChromeMain]; [[startupInformation expect] stopChromeMain];
...@@ -551,13 +546,11 @@ TEST_F(AppStateWithThreadTest, willTerminate) { ...@@ -551,13 +546,11 @@ TEST_F(AppStateWithThreadTest, willTerminate) {
id application = [OCMockObject mockForClass:[UIApplication class]]; id application = [OCMockObject mockForClass:[UIApplication class]];
// Action. // Action.
[appState applicationWillTerminate:application [appState applicationWillTerminate:application];
applicationNavigation:appNavigation];
// Test. // Test.
EXPECT_OCMOCK_VERIFY(browserViewController); EXPECT_OCMOCK_VERIFY(browserViewController);
EXPECT_OCMOCK_VERIFY(startupInformation); EXPECT_OCMOCK_VERIFY(startupInformation);
EXPECT_OCMOCK_VERIFY(appNavigation);
EXPECT_OCMOCK_VERIFY(application); EXPECT_OCMOCK_VERIFY(application);
EXPECT_FALSE(interfaceProvider.mainInterface.userInteractionEnabled); EXPECT_FALSE(interfaceProvider.mainInterface.userInteractionEnabled);
EXPECT_TRUE(interfaceProvider.deviceManagerCleaned); EXPECT_TRUE(interfaceProvider.deviceManagerCleaned);
...@@ -726,7 +719,6 @@ TEST_F(AppStateTest, applicationWillEnterForeground) { ...@@ -726,7 +719,6 @@ TEST_F(AppStateTest, applicationWillEnterForeground) {
id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]]; id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]];
StubBrowserInterfaceProvider* interfaceProvider = getInterfaceProvider(); StubBrowserInterfaceProvider* interfaceProvider = getInterfaceProvider();
id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)]; id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
id tabModel = [OCMockObject mockForClass:[TabModel class]]; id tabModel = [OCMockObject mockForClass:[TabModel class]];
BrowserInitializationStageType stage = INITIALIZATION_STAGE_FOREGROUND; BrowserInitializationStageType stage = INITIALIZATION_STAGE_FOREGROUND;
...@@ -761,8 +753,7 @@ TEST_F(AppStateTest, applicationWillEnterForeground) { ...@@ -761,8 +753,7 @@ TEST_F(AppStateTest, applicationWillEnterForeground) {
[getAppStateWithMock() applicationWillEnterForeground:application [getAppStateWithMock() applicationWillEnterForeground:application
metricsMediator:metricsMediator metricsMediator:metricsMediator
memoryHelper:memoryHelper memoryHelper:memoryHelper
tabOpener:tabOpener tabOpener:tabOpener];
appNavigation:appNavigation];
// Tests. // Tests.
EXPECT_OCMOCK_VERIFY(metricsMediator); EXPECT_OCMOCK_VERIFY(metricsMediator);
...@@ -782,7 +773,6 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromBackground) { ...@@ -782,7 +773,6 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromBackground) {
id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]]; id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]];
id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]]; id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]];
id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)]; id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
BrowserInitializationStageType stage = INITIALIZATION_STAGE_BACKGROUND; BrowserInitializationStageType stage = INITIALIZATION_STAGE_BACKGROUND;
[[[getBrowserLauncherMock() stub] andReturnValue:@(stage)] [[[getBrowserLauncherMock() stub] andReturnValue:@(stage)]
...@@ -799,8 +789,7 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromBackground) { ...@@ -799,8 +789,7 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromBackground) {
[getAppStateWithMock() applicationWillEnterForeground:application [getAppStateWithMock() applicationWillEnterForeground:application
metricsMediator:metricsMediator metricsMediator:metricsMediator
memoryHelper:memoryHelper memoryHelper:memoryHelper
tabOpener:tabOpener tabOpener:tabOpener];
appNavigation:appNavigation];
// Tests. // Tests.
EXPECT_OCMOCK_VERIFY(getBrowserLauncherMock()); EXPECT_OCMOCK_VERIFY(getBrowserLauncherMock());
...@@ -815,7 +804,6 @@ TEST_F(AppStateTest, ...@@ -815,7 +804,6 @@ TEST_F(AppStateTest,
id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]]; id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]];
id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]]; id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]];
id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)]; id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
id window = getWindowMock(); id window = getWindowMock();
...@@ -832,8 +820,7 @@ TEST_F(AppStateTest, ...@@ -832,8 +820,7 @@ TEST_F(AppStateTest,
[getAppStateWithMock() applicationWillEnterForeground:application [getAppStateWithMock() applicationWillEnterForeground:application
metricsMediator:metricsMediator metricsMediator:metricsMediator
memoryHelper:memoryHelper memoryHelper:memoryHelper
tabOpener:tabOpener tabOpener:tabOpener];
appNavigation:appNavigation];
// Tests. // Tests.
EXPECT_OCMOCK_VERIFY(window); EXPECT_OCMOCK_VERIFY(window);
...@@ -848,7 +835,6 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromForegroundSafeMode) { ...@@ -848,7 +835,6 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromForegroundSafeMode) {
id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]]; id metricsMediator = [OCMockObject mockForClass:[MetricsMediator class]];
id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]]; id memoryHelper = [OCMockObject mockForClass:[MemoryWarningHelper class]];
id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)]; id tabOpener = [OCMockObject mockForProtocol:@protocol(TabOpening)];
id appNavigation = [OCMockObject mockForProtocol:@protocol(AppNavigation)];
BrowserInitializationStageType stage = INITIALIZATION_STAGE_FOREGROUND; BrowserInitializationStageType stage = INITIALIZATION_STAGE_FOREGROUND;
[[[getBrowserLauncherMock() stub] andReturnValue:@(stage)] [[[getBrowserLauncherMock() stub] andReturnValue:@(stage)]
...@@ -866,8 +852,7 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromForegroundSafeMode) { ...@@ -866,8 +852,7 @@ TEST_F(AppStateTest, applicationWillEnterForegroundFromForegroundSafeMode) {
[appState applicationWillEnterForeground:application [appState applicationWillEnterForeground:application
metricsMediator:metricsMediator metricsMediator:metricsMediator
memoryHelper:memoryHelper memoryHelper:memoryHelper
tabOpener:tabOpener tabOpener:tabOpener];
appNavigation:appNavigation];
} }
// Tests that -applicationDidEnterBackground creates an incognito blocker. // Tests that -applicationDidEnterBackground creates an incognito blocker.
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/app_state.h" #import "ios/chrome/app/application_delegate/app_state.h"
#import "ios/chrome/app/application_delegate/browser_launcher.h" #import "ios/chrome/app/application_delegate/browser_launcher.h"
#import "ios/chrome/app/application_delegate/memory_warning_helper.h" #import "ios/chrome/app/application_delegate/memory_warning_helper.h"
...@@ -47,8 +46,6 @@ ...@@ -47,8 +46,6 @@
// Handles the application stage changes. // Handles the application stage changes.
AppState* _appState; AppState* _appState;
// Handles tab switcher. // Handles tab switcher.
id<AppNavigation> _appNavigation;
// Handles tab switcher.
id<TabSwitching> _tabSwitcherProtocol; id<TabSwitching> _tabSwitcherProtocol;
} }
...@@ -91,7 +88,6 @@ ...@@ -91,7 +88,6 @@
_mainController.sceneController = _sceneController; _mainController.sceneController = _sceneController;
_tabSwitcherProtocol = _sceneController; _tabSwitcherProtocol = _sceneController;
_tabOpener = _sceneController; _tabOpener = _sceneController;
_appNavigation = _sceneController;
} }
} }
return self; return self;
...@@ -194,8 +190,7 @@ ...@@ -194,8 +190,7 @@
[_appState applicationWillEnterForeground:application [_appState applicationWillEnterForeground:application
metricsMediator:_metricsMediator metricsMediator:_metricsMediator
memoryHelper:_memoryHelper memoryHelper:_memoryHelper
tabOpener:_tabOpener tabOpener:_tabOpener];
appNavigation:_appNavigation];
} }
- (void)applicationWillTerminate:(UIApplication*)application { - (void)applicationWillTerminate:(UIApplication*)application {
...@@ -204,8 +199,7 @@ ...@@ -204,8 +199,7 @@
// Instead of adding code here, consider if it could be handled by listening // Instead of adding code here, consider if it could be handled by listening
// for UIApplicationWillterminate. // for UIApplicationWillterminate.
[_appState applicationWillTerminate:application [_appState applicationWillTerminate:application];
applicationNavigation:_appNavigation];
} }
- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application { - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application {
...@@ -241,7 +235,6 @@ ...@@ -241,7 +235,6 @@
_tabSwitcherProtocol = sceneController; _tabSwitcherProtocol = sceneController;
_tabOpener = sceneController; _tabOpener = sceneController;
_appNavigation = sceneController;
// TODO(crbug.com/1060645): This should be called later, or this flow should // TODO(crbug.com/1060645): This should be called later, or this flow should
// be changed completely. // be changed completely.
...@@ -249,8 +242,7 @@ ...@@ -249,8 +242,7 @@
[_appState applicationWillEnterForeground:UIApplication.sharedApplication [_appState applicationWillEnterForeground:UIApplication.sharedApplication
metricsMediator:_metricsMediator metricsMediator:_metricsMediator
memoryHelper:_memoryHelper memoryHelper:_memoryHelper
tabOpener:_tabOpener tabOpener:_tabOpener];
appNavigation:_appNavigation];
} }
} }
} }
......
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
#include "ios/chrome/browser/system_flags.h" #include "ios/chrome/browser/system_flags.h"
#import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/tabs/tab_model.h"
#import "ios/chrome/browser/ui/appearance/appearance_customization.h" #import "ios/chrome/browser/ui/appearance/appearance_customization.h"
#import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.h"
#import "ios/chrome/browser/ui/browser_view/browser_coordinator.h" #import "ios/chrome/browser/ui/browser_view/browser_coordinator.h"
#import "ios/chrome/browser/ui/browser_view/browser_view_controller.h" #import "ios/chrome/browser/ui/browser_view/browser_view_controller.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
...@@ -341,8 +340,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -341,8 +340,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
- (void)scheduleMemoryDebuggingTools; - (void)scheduleMemoryDebuggingTools;
// Asynchronously kick off regular free memory checks. // Asynchronously kick off regular free memory checks.
- (void)startFreeMemoryMonitoring; - (void)startFreeMemoryMonitoring;
// Asynchronously schedules the notification of the AuthenticationService.
- (void)scheduleAuthenticationServiceNotification;
// Asynchronously schedules the reset of the failed startup attempt counter. // Asynchronously schedules the reset of the failed startup attempt counter.
- (void)scheduleStartupAttemptReset; - (void)scheduleStartupAttemptReset;
// Asynchronously schedules the cleanup of crash reports. // Asynchronously schedules the cleanup of crash reports.
...@@ -888,23 +885,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -888,23 +885,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
}]; }];
} }
- (void)scheduleAuthenticationServiceNotification {
[[DeferredInitializationRunner sharedInstance]
enqueueBlockNamed:kAuthenticationServiceNotification
block:^{
// Active browser state should have been set before
// scheduling any authentication service notification.
DCHECK([self currentBrowserState]);
if ([SignedInAccountsViewController
shouldBePresentedForBrowserState:
[self currentBrowserState]]) {
[self.sceneController
presentSignedInAccountsViewControllerForBrowserState:
[self currentBrowserState]];
}
}];
}
- (void)scheduleStartupAttemptReset { - (void)scheduleStartupAttemptReset {
[[DeferredInitializationRunner sharedInstance] [[DeferredInitializationRunner sharedInstance]
enqueueBlockNamed:kStartupAttemptReset enqueueBlockNamed:kStartupAttemptReset
...@@ -1047,7 +1027,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1047,7 +1027,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self scheduleMemoryDebuggingTools]; [self scheduleMemoryDebuggingTools];
[StartupTasks [StartupTasks
scheduleDeferredBrowserStateInitialization:self.mainBrowserState]; scheduleDeferredBrowserStateInitialization:self.mainBrowserState];
[self scheduleAuthenticationServiceNotification];
[self sendQueuedFeedback]; [self sendQueuedFeedback];
[self scheduleSpotlightResync]; [self scheduleSpotlightResync];
[self scheduleDeleteTempDownloadsDirectory]; [self scheduleDeleteTempDownloadsDirectory];
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/tab_opening.h" #import "ios/chrome/app/application_delegate/tab_opening.h"
#import "ios/chrome/app/application_delegate/tab_switching.h" #import "ios/chrome/app/application_delegate/tab_switching.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
...@@ -19,8 +18,7 @@ ...@@ -19,8 +18,7 @@
@protocol MainControllerGuts; @protocol MainControllerGuts;
// The controller object for a scene. Reacts to scene state changes. // The controller object for a scene. Reacts to scene state changes.
@interface SceneController : NSObject <AppNavigation, @interface SceneController : NSObject <AppURLLoadingServiceDelegate,
AppURLLoadingServiceDelegate,
SceneStateObserver, SceneStateObserver,
ApplicationCommands, ApplicationCommands,
TabSwitcherDelegate, TabSwitcherDelegate,
......
...@@ -253,6 +253,19 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -253,6 +253,19 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
if (level > SceneActivationLevelBackground && !self.hasInitializedUI) { if (level > SceneActivationLevelBackground && !self.hasInitializedUI) {
[self initializeUI]; [self initializeUI];
} }
if (level == SceneActivationLevelForegroundActive) {
[self presentSignInAccountsViewControllerIfNecessary];
}
}
- (void)presentSignInAccountsViewControllerIfNecessary {
ChromeBrowserState* browserState = self.currentInterface.browserState;
DCHECK(browserState);
if ([SignedInAccountsViewController
shouldBePresentedForBrowserState:browserState]) {
[self presentSignedInAccountsViewControllerForBrowserState:browserState];
}
} }
#pragma mark - SceneControllerGuts #pragma mark - SceneControllerGuts
...@@ -1451,7 +1464,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -1451,7 +1464,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
self.incognitoInterface)]; self.incognitoInterface)];
} }
#pragma mark - AppNavigation #pragma mark - Sign In UI presentation
- (void)presentSignedInAccountsViewControllerForBrowserState: - (void)presentSignedInAccountsViewControllerForBrowserState:
(ChromeBrowserState*)browserState { (ChromeBrowserState*)browserState {
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#import "ios/chrome/browser/url_loading/url_loading_params.h" #import "ios/chrome/browser/url_loading/url_loading_params.h"
#import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h"
class ChromeBrowserState;
@class BrowserViewWrangler; @class BrowserViewWrangler;
@protocol SceneControllerGuts <WebStateListObserving> @protocol SceneControllerGuts <WebStateListObserving>
...@@ -45,13 +44,6 @@ class ChromeBrowserState; ...@@ -45,13 +44,6 @@ class ChromeBrowserState;
- (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion - (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion
dismissOmnibox:(BOOL)dismissOmnibox; dismissOmnibox:(BOOL)dismissOmnibox;
#pragma mark - AppNavigation helpers
// Presents a SignedInAccountsViewController for |browserState| on the top view
// controller.
- (void)presentSignedInAccountsViewControllerForBrowserState:
(ChromeBrowserState*)browserState;
#pragma mark - iOS 12 compat #pragma mark - iOS 12 compat
// Method called on SceneController when the scene disconnects. Exposed here for // Method called on SceneController when the scene disconnects. Exposed here for
......
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