Commit 5fe0eef0 authored by Sergio Collazos's avatar Sergio Collazos Committed by Commit Bot

Revert "Encapsulate dismissal cleanup within SettingsNavigationController"

This reverts commit 44aa3a7f.

Reason for revert: Causes crbug.com/819999

Original change's description:
> Encapsulate dismissal cleanup within SettingsNavigationController
> 
> Bug: 782943
> Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
> Change-Id: If5ebc06503448526b57f42ea6543b5373efe2c90
> Reviewed-on: https://chromium-review.googlesource.com/826024
> Reviewed-by: Mark Cogan <marq@chromium.org>
> Reviewed-by: edchin <edchin@chromium.org>
> Commit-Queue: Peter Laurens <peterlaurens@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#525372}

TBR=marq@chromium.org,edchin@chromium.org,peterlaurens@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 782943
Change-Id: If7daa3faaa515430e5354c9fe0c4654840094696
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/966961Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543826}
parent 00e7992e
...@@ -2065,6 +2065,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -2065,6 +2065,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
- (void)closeSettingsAnimated:(BOOL)animated - (void)closeSettingsAnimated:(BOOL)animated
completion:(ProceduralBlock)completion { completion:(ProceduralBlock)completion {
DCHECK(_settingsNavigationController); DCHECK(_settingsNavigationController);
[_settingsNavigationController settingsWillBeDismissed];
UIViewController* presentingViewController = UIViewController* presentingViewController =
[_settingsNavigationController presentingViewController]; [_settingsNavigationController presentingViewController];
DCHECK(presentingViewController); DCHECK(presentingViewController);
......
...@@ -92,6 +92,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10; ...@@ -92,6 +92,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10;
[_alertCoordinator executeCancelHandler]; [_alertCoordinator executeCancelHandler];
[_alertCoordinator stop]; [_alertCoordinator stop];
if (_navigationController) { if (_navigationController) {
[_navigationController settingsWillBeDismissed];
_navigationController = nil; _navigationController = nil;
[[_delegate presentingViewController] dismissViewControllerAnimated:NO [[_delegate presentingViewController] dismissViewControllerAnimated:NO
completion:nil]; completion:nil];
...@@ -414,6 +415,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10; ...@@ -414,6 +415,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10;
strongSelf->_navigationController = nil; strongSelf->_navigationController = nil;
[[strongSelf delegate] didChooseClearDataPolicy:shouldClearData]; [[strongSelf delegate] didChooseClearDataPolicy:shouldClearData];
}; };
[_navigationController settingsWillBeDismissed];
[[_delegate presentingViewController] dismissViewControllerAnimated:YES [[_delegate presentingViewController] dismissViewControllerAnimated:YES
completion:block]; completion:block];
} }
...@@ -431,6 +433,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10; ...@@ -431,6 +433,7 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10;
strongSelf->_navigationController = nil; strongSelf->_navigationController = nil;
[[strongSelf delegate] didChooseCancel]; [[strongSelf delegate] didChooseCancel];
}; };
[_navigationController settingsWillBeDismissed];
[[_delegate presentingViewController] dismissViewControllerAnimated:YES [[_delegate presentingViewController] dismissViewControllerAnimated:YES
completion:block]; completion:block];
} }
......
...@@ -41,8 +41,7 @@ class ChromeBrowserState; ...@@ -41,8 +41,7 @@ class ChromeBrowserState;
// Controller to modify user settings. // Controller to modify user settings.
@interface SettingsNavigationController @interface SettingsNavigationController
: UINavigationController<ApplicationSettingsCommands, : UINavigationController<ApplicationSettingsCommands>
SettingsControllerProtocol>
// Whether sync changes should be committed when the settings are being // Whether sync changes should be committed when the settings are being
// dismissed. Defaults to YES. // dismissed. Defaults to YES.
...@@ -139,6 +138,10 @@ initWithRootViewController:(UIViewController*)rootViewController ...@@ -139,6 +138,10 @@ initWithRootViewController:(UIViewController*)rootViewController
// Returns the current main browser state. // Returns the current main browser state.
- (ios::ChromeBrowserState*)mainBrowserState; - (ios::ChromeBrowserState*)mainBrowserState;
// Notifies this |SettingsNavigationController| that it will be dismissed such
// that it has a possibility to do necessary clean up.
- (void)settingsWillBeDismissed;
// Closes this |SettingsNavigationController| by asking its delegate. // Closes this |SettingsNavigationController| by asking its delegate.
- (void)closeSettings; - (void)closeSettings;
......
...@@ -289,13 +289,6 @@ initWithRootViewController:(UIViewController*)rootViewController ...@@ -289,13 +289,6 @@ initWithRootViewController:(UIViewController*)rootViewController
return self; return self;
} }
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.isBeingDismissed) {
[self settingsWillBeDismissed];
}
}
- (void)settingsWillBeDismissed { - (void)settingsWillBeDismissed {
// Notify all controllers that settings are about to be dismissed. // Notify all controllers that settings are about to be dismissed.
for (UIViewController* controller in [self viewControllers]) { for (UIViewController* controller in [self viewControllers]) {
......
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