Commit bfde5738 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Moves Infobar UI setup to InfobarCoordinator

- The infobarContainerView is now being added in the Coordinator start method.
- The infobarCoordinator now starts right after its initialized.

Bug: 892376
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Ifd5e99e165280df73849f5590e2ccbe9d32945c8
Reviewed-on: https://chromium-review.googlesource.com/c/1282035Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600001}
parent 94a4ced7
......@@ -2152,16 +2152,15 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
[self.tabStripCoordinator start];
}
// Create infobar Coordinator.
if (!self.infoBarCoordinator) {
self.infoBarCoordinator =
[[InfobarCoordinator alloc] initWithBaseViewController:self
browserState:_browserState
tabModel:_model];
self.infoBarCoordinator.dispatcher = self.dispatcher;
self.infoBarCoordinator.positioner = self;
self.infoBarCoordinator.syncPresenter = self;
}
// Create the Infobar Coordinator.
self.infoBarCoordinator =
[[InfobarCoordinator alloc] initWithBaseViewController:self
browserState:_browserState
tabModel:_model];
self.infoBarCoordinator.dispatcher = self.dispatcher;
self.infoBarCoordinator.positioner = self;
self.infoBarCoordinator.syncPresenter = self;
[self.infoBarCoordinator start];
}
// Called by NSNotificationCenter when the view's window becomes key to account
......@@ -2309,8 +2308,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
[self.sideSwipeController addHorizontalGesturesToView:self.view];
[self.infoBarCoordinator start];
// Create child coordinators.
_activityServiceCoordinator = [[ActivityServiceLegacyCoordinator alloc]
initWithBaseViewController:self];
......@@ -2407,18 +2404,11 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
.viewController];
}
// Place the infobar container above the content area.
UIView* infoBarContainerView = [self.infoBarCoordinator view];
if (initialLayout) {
[self.view insertSubview:infoBarContainerView
aboveSubview:self.contentArea];
}
// Place the toolbar controller above the infobar container and adds the
// layout guides.
if (initialLayout) {
UIView* bottomView =
IsIPadIdiom() ? _fakeStatusBarView : infoBarContainerView;
IsIPadIdiom() ? _fakeStatusBarView : [self.infoBarCoordinator view];
[[self view]
insertSubview:self.primaryToolbarCoordinator.viewController.view
aboveSubview:bottomView];
......@@ -2493,15 +2483,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
}
self.contentArea.frame = contentFrame;
if (initialLayout) {
// Adjust the infobar container to be either at the bottom of the screen
// (iPhone) or on the lower toolbar edge (iPad).
CGRect infoBarFrame = contentFrame;
infoBarFrame.origin.y = CGRectGetMaxY(contentFrame);
infoBarFrame.size.height = 0;
[infoBarContainerView setFrame:infoBarFrame];
}
// Attach the typing shield to the content area but have it hidden.
self.typingShield.frame = self.contentArea.frame;
if (initialLayout) {
......
......@@ -59,6 +59,13 @@
}
- (void)start {
[self.baseViewController.view insertSubview:_infoBarContainer->view()
aboveSubview:self.positioner.parentView];
CGRect infoBarFrame = self.positioner.parentView.frame;
infoBarFrame.origin.y = CGRectGetMaxY(infoBarFrame);
infoBarFrame.size.height = 0;
[_infoBarContainer->view() setFrame:infoBarFrame];
infobars::InfoBarManager* infoBarManager = nullptr;
if (self.tabModel.currentTab) {
DCHECK(self.tabModel.currentTab.webState);
......
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