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( ...@@ -646,7 +646,12 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
#pragma mark - StartupInformation implementation. #pragma mark - StartupInformation implementation.
- (BOOL)isPresentingFirstRunUI { - (BOOL)isPresentingFirstRunUI {
return self.sceneController.presentingFirstRunUI; BOOL isPresentingFirstRunUI = NO;
for (SceneState* scene in self.appState.connectedScenes) {
isPresentingFirstRunUI &= scene.presentingFirstRunUI;
}
return isPresentingFirstRunUI;
} }
- (FirstUserActionRecorder*)firstUserActionRecorder { - (FirstUserActionRecorder*)firstUserActionRecorder {
......
...@@ -172,10 +172,6 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -172,10 +172,6 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// TabSwitcher object -- the tab grid. // TabSwitcher object -- the tab grid.
@property(nonatomic, strong) id<TabSwitcher> tabSwitcher; @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 coordinator, lazily created the first time it is accessed. Manages
// the main view controller. This property should not be accessed before the // the main view controller. This property should not be accessed before the
// browser has started up to the FOREGROUND stage. // browser has started up to the FOREGROUND stage.
...@@ -458,7 +454,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -458,7 +454,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// Initializes the first run UI and presents it to the user. // Initializes the first run UI and presents it to the user.
- (void)showFirstRunUI { - (void)showFirstRunUI {
// Register for the first run dismissal notification to reset // Register for the first run dismissal notification to reset
// |self.presentingFirstRunUI| flag; // |sceneState.presentingFirstRunUI| flag;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver:self addObserver:self
selector:@selector(handleFirstRunUIWillFinish) selector:@selector(handleFirstRunUIWillFinish)
...@@ -481,15 +477,15 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -481,15 +477,15 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
navController.modalPresentationStyle = UIModalPresentationFullScreen; navController.modalPresentationStyle = UIModalPresentationFullScreen;
CGRect appFrame = [[UIScreen mainScreen] bounds]; CGRect appFrame = [[UIScreen mainScreen] bounds];
[[navController view] setFrame:appFrame]; [[navController view] setFrame:appFrame];
self.presentingFirstRunUI = YES; self.sceneState.presentingFirstRunUI = YES;
[self.mainInterface.viewController presentViewController:navController [self.mainInterface.viewController presentViewController:navController
animated:NO animated:NO
completion:nil]; completion:nil];
} }
- (void)handleFirstRunUIWillFinish { - (void)handleFirstRunUIWillFinish {
DCHECK(self.presentingFirstRunUI); DCHECK(self.sceneState.presentingFirstRunUI);
self.presentingFirstRunUI = NO; self.sceneState.presentingFirstRunUI = NO;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver:self removeObserver:self
name:kChromeFirstRunUIWillFinishNotification name:kChromeFirstRunUIWillFinishNotification
...@@ -503,7 +499,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -503,7 +499,7 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// Don't show promos if first run is shown. (Note: This flag is only YES // 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 // while the first run UI is visible. However, as this function is called
// immediately after the UI is shown, it's a safe check.) // immediately after the UI is shown, it's a safe check.)
if (self.presentingFirstRunUI) if (self.sceneState.presentingFirstRunUI)
return; return;
// Don't show promos in Incognito mode. // Don't show promos in Incognito mode.
if (self.currentInterface == self.incognitoInterface) if (self.currentInterface == self.incognitoInterface)
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
completion:(ProceduralBlock)completion; completion:(ProceduralBlock)completion;
// Testing only. // Testing only.
- (BOOL)presentingFirstRunUI;
- (void)showFirstRunUI; - (void)showFirstRunUI;
- (void)setTabSwitcher:(id<TabSwitcher>)switcher; - (void)setTabSwitcher:(id<TabSwitcher>)switcher;
- (id<TabSwitcher>)tabSwitcher; - (id<TabSwitcher>)tabSwitcher;
......
...@@ -54,6 +54,10 @@ typedef NS_ENUM(NSUInteger, SceneActivationLevel) { ...@@ -54,6 +54,10 @@ typedef NS_ENUM(NSUInteger, SceneActivationLevel) {
@property(nonatomic, strong, readonly) id<BrowserInterfaceProvider> @property(nonatomic, strong, readonly) id<BrowserInterfaceProvider>
interfaceProvider; 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. // The controller for this scene.
@property(nonatomic, weak) SceneController* controller; @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