Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: ios/chrome/browser/ui/dialogs/dialog_presenter.mm

Issue 2936643003: Allow cancelling the currently-presented dialog. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/dialogs/dialog_presenter.mm
diff --git a/ios/chrome/browser/ui/dialogs/dialog_presenter.mm b/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
index 5be1336d79c6197da14be2bf9134ffb2e13f5a03..812bdf2c834432e8a0bc8e70a4df6af939a62085 100644
--- a/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
+++ b/ios/chrome/browser/ui/dialogs/dialog_presenter.mm
@@ -312,15 +312,23 @@ - (void)runAuthDialogForProtectionSpace:(NSURLProtectionSpace*)protectionSpace
}
- (void)cancelDialogForWebState:(web::WebState*)webState {
- DCHECK_NE(webState, self.presentedDialogWebState);
- AlertCoordinator* dialogToCancel = _dialogCoordinatorsForWebStates[webState];
- if (dialogToCancel) {
+ BOOL cancelingPresentedDialog = webState == self.presentedDialogWebState;
+ AlertCoordinator* dialogToCancel =
+ cancelingPresentedDialog ? self.presentedDialogCoordinator
+ : _dialogCoordinatorsForWebStates[webState];
+ DCHECK(!cancelingPresentedDialog || dialogToCancel);
+ [dialogToCancel executeCancelHandler];
+ [dialogToCancel stop];
+
+ if (cancelingPresentedDialog) {
rohitrao (ping after 24h) 2017/06/12 23:43:50 Should we DCHECK(_dialogCoordinatorsForWebStates[w
kkhorimoto 2017/06/13 00:10:13 Done.
+ // Simulate a button tap to trigger showing the next dialog.
rohitrao (ping after 24h) 2017/06/12 23:43:50 Can a single WebState have multiple dialogs queued
kkhorimoto 2017/06/13 00:10:13 This class was built on the assumption that it was
+ [self buttonWasTappedForCoordinator:dialogToCancel];
rohitrao (ping after 24h) 2017/06/12 23:43:50 It feels a little weird to call a function with th
kkhorimoto 2017/06/13 00:10:13 I renamed it to |-dialogCoordinatorWasStopped:|, w
+ } else if (dialogToCancel) {
+ // Clean up queued state.
auto it =
std::find(_queuedWebStates.begin(), _queuedWebStates.end(), webState);
DCHECK(it != _queuedWebStates.end());
_queuedWebStates.erase(it);
- [dialogToCancel executeCancelHandler];
- [dialogToCancel stop];
_dialogCoordinatorsForWebStates.erase(webState);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698