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

[multiball] Remove isPresentingFirstRunUI from SceneController.

Moves the first run UI flag to SceneState, and updates MainController to
look for any scene showing first run UI.

Bug: 1045660
Change-Id: Ia3cc3b6db9b4899e96c8c7098c336c72ee5c9704
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129538Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755354}
parent 5da35d38
......@@ -646,7 +646,12 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
#pragma mark - StartupInformation implementation.
- (BOOL)isPresentingFirstRunUI {
return self.sceneController.presentingFirstRunUI;
BOOL isPresentingFirstRunUI = NO;
for (SceneState* scene in self.appState.connectedScenes) {
isPresentingFirstRunUI &= scene.presentingFirstRunUI;
}
return isPresentingFirstRunUI;
}
- (FirstUserActionRecorder*)firstUserActionRecorder {
......
......@@ -172,10 +172,6 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// TabSwitcher object -- the tab grid.
@property(nonatomic, strong) id<TabSwitcher> tabSwitcher;
// True if First Run UI (terms of service & sync sign-in) is being presented
// in a modal dialog.
@property(nonatomic, assign) BOOL presentingFirstRunUI;
// The main coordinator, lazily created the first time it is accessed. Manages
// the main view controller. This property should not be accessed before the
// browser has started up to the FOREGROUND stage.
......@@ -458,7 +454,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// Initializes the first run UI and presents it to the user.
- (void)showFirstRunUI {
// Register for the first run dismissal notification to reset
// |self.presentingFirstRunUI| flag;
// |sceneState.presentingFirstRunUI| flag;
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleFirstRunUIWillFinish)
......@@ -481,15 +477,15 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
navController.modalPresentationStyle = UIModalPresentationFullScreen;
CGRect appFrame = [[UIScreen mainScreen] bounds];
[[navController view] setFrame:appFrame];
self.presentingFirstRunUI = YES;
self.sceneState.presentingFirstRunUI = YES;
[self.mainInterface.viewController presentViewController:navController
animated:NO
completion:nil];
}
- (void)handleFirstRunUIWillFinish {
DCHECK(self.presentingFirstRunUI);
self.presentingFirstRunUI = NO;
DCHECK(self.sceneState.presentingFirstRunUI);
self.sceneState.presentingFirstRunUI = NO;
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:kChromeFirstRunUIWillFinishNotification
......@@ -503,7 +499,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// Don't show promos if first run is shown. (Note: This flag is only YES
// while the first run UI is visible. However, as this function is called
// immediately after the UI is shown, it's a safe check.)
if (self.presentingFirstRunUI)
if (self.sceneState.presentingFirstRunUI)
return;
// Don't show promos in Incognito mode.
if (self.currentInterface == self.incognitoInterface)
......
......@@ -28,7 +28,6 @@
completion:(ProceduralBlock)completion;
// Testing only.
- (BOOL)presentingFirstRunUI;
- (void)showFirstRunUI;
- (void)setTabSwitcher:(id<TabSwitcher>)switcher;
- (id<TabSwitcher>)tabSwitcher;
......
......@@ -54,6 +54,10 @@ typedef NS_ENUM(NSUInteger, SceneActivationLevel) {
@property(nonatomic, strong, readonly) id<BrowserInterfaceProvider>
interfaceProvider;
// True if First Run UI (terms of service & sync sign-in) is being presented
// in a modal dialog.
@property(nonatomic, assign) BOOL presentingFirstRunUI;
// The controller for this scene.
@property(nonatomic, weak) SceneController* controller;
......
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