Commit 21831056 authored by adamta's avatar adamta Committed by Commit Bot

[iOS] Add NTP to BVC view hierarchy for Discover feed IPH

Adds the content suggestions collection view to the VC hierarchy from
the BVC. The named guide for the Discover feed IPH was not usable since
it could not make its way up to the BVC through its view hierarchy.

Bug: 1131571
Change-Id: I97d6f4d9e0dc8642b93b040c2c1003f3588f853d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414613
Commit-Queue: Adam Trudeau-Arcaro <adamta@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816297}
parent 9790bb05
...@@ -4866,6 +4866,14 @@ NSString* const kBrowserViewControllerSnackbarCategory = ...@@ -4866,6 +4866,14 @@ NSString* const kBrowserViewControllerSnackbarCategory =
newTabPageCoordinator.toolbarDelegate = self.toolbarInterface; newTabPageCoordinator.toolbarDelegate = self.toolbarInterface;
newTabPageCoordinator.webState = webState; newTabPageCoordinator.webState = webState;
_ntpCoordinatorsForWebStates[webState] = newTabPageCoordinator; _ntpCoordinatorsForWebStates[webState] = newTabPageCoordinator;
[newTabPageCoordinator.viewController
willMoveToParentViewController:self.browserContainerViewController];
[self.browserContainerViewController
addChildViewController:newTabPageCoordinator.viewController];
[self.browserContainerViewController.view
addSubview:newTabPageCoordinator.viewController.view];
[newTabPageCoordinator.viewController
didMoveToParentViewController:self.browserContainerViewController];
} else { } else {
NewTabPageCoordinator* newTabPageCoordinator = NewTabPageCoordinator* newTabPageCoordinator =
_ntpCoordinatorsForWebStates[webState]; _ntpCoordinatorsForWebStates[webState];
......
...@@ -265,8 +265,8 @@ ...@@ -265,8 +265,8 @@
self.suggestionsViewController.overscrollDelegate = self; self.suggestionsViewController.overscrollDelegate = self;
self.suggestionsViewController.themeChangeDelegate = self; self.suggestionsViewController.themeChangeDelegate = self;
self.suggestionsViewController.metricsRecorder = self.metricsRecorder; self.suggestionsViewController.metricsRecorder = self.metricsRecorder;
id<SnackbarCommands> dispatcher = HandlerForProtocol( id<SnackbarCommands> dispatcher =
self.browser->GetCommandDispatcher(), SnackbarCommands); static_cast<id<SnackbarCommands>>(self.browser->GetCommandDispatcher());
self.suggestionsViewController.dispatcher = dispatcher; self.suggestionsViewController.dispatcher = dispatcher;
self.suggestionsViewController.discoverFeedMenuHandler = self; self.suggestionsViewController.discoverFeedMenuHandler = self;
self.suggestionsViewController.discoverFeedMetricsRecorder = self.suggestionsViewController.discoverFeedMetricsRecorder =
......
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
- (void)stop { - (void)stop {
if (!self.started) if (!self.started)
return; return;
[self.viewController willMoveToParentViewController:nil];
[self.viewController.view removeFromSuperview];
[self.viewController removeFromParentViewController];
[self.contentSuggestionsCoordinator stop]; [self.contentSuggestionsCoordinator stop];
self.contentSuggestionsCoordinator = nil; self.contentSuggestionsCoordinator = nil;
self.incognitoViewController = nil; self.incognitoViewController = nil;
......
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