Commit c6b0a7f2 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Open an NTP on warm start if no tab is open

Bug: 1070996
Change-Id: I5797d54bf3689aba27854b01ef17e1efaff828e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218776
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774086}
parent 1466a515
...@@ -277,8 +277,9 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -277,8 +277,9 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
// ends. // ends.
return; return;
} }
BOOL initializingUIInColdStart =
if (level > SceneActivationLevelBackground && !self.hasInitializedUI) { level > SceneActivationLevelBackground && !self.hasInitializedUI;
if (initializingUIInColdStart) {
[self initializeUI]; [self initializeUI];
} }
...@@ -316,6 +317,24 @@ const NSTimeInterval kDisplayPromoDelay = 0.1; ...@@ -316,6 +317,24 @@ const NSTimeInterval kDisplayPromoDelay = 0.1;
startupInformation:self.mainController startupInformation:self.mainController
appState:self.mainController.appState]; appState:self.mainController.appState];
} }
if (!initializingUIInColdStart && self.tabSwitcherIsActive &&
[self shouldOpenNTPTabOnActivationOfBrowser:self.currentInterface
.browser]) {
DCHECK(!self.dismissingTabSwitcher);
[self beginDismissingTabSwitcherWithCurrentBrowser:self.currentInterface
.browser
focusOmnibox:NO];
OpenNewTabCommand* command = [OpenNewTabCommand
commandWithIncognito:self.currentInterface.incognito];
command.userInitiated = NO;
Browser* browser = self.currentInterface.browser;
id<ApplicationCommands> applicationHandler = HandlerForProtocol(
browser->GetCommandDispatcher(), ApplicationCommands);
[applicationHandler openURLInNewTab:command];
[self finishDismissingTabSwitcher];
}
} }
} }
......
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