Per discussion on crrev.com/c/617994:
https://chromium-review.googlesource.com/c/chromium/src/+/617994/3/ios/clean/chrome/browser/ui/commands/java_script_dialog_blocking_commands.h#13
Some commands are only necessary for internal state maintenance for a coordinator/mediator/view controller component (i.e. ContextMenuDismissalCommands, HTTPAuthDialogDismissalCommands, JavaScriptDialogBlockingDismissalCommands, JavaScriptDialogDismissalCommands). For these situations, the view controller (subclass of UIAlertController) automatically dismisses itself when a user interacts with it. In this situation, it's necessary to send a command to its coordinator to call |-stop| so that the coordinator hierarchy stays in sync with the view controller hierarchy. Since these will never need to be handled by classes other than the coordinators, we should find a way to handle this internally without polluting the commands/ directory.
Some possible solutions:
- Create a commands/ directory for each dialog type where we can declare commands that are only used internally. This is my preferred method since it's most in-line with the current implementation.
- Pass a coordinator pointer to the mediator and call |-stop| from the mediator's command handling.
- Use delegation to notify coordinators when their view controllers dismiss themselves.
Comment 1 by kkhorimoto@chromium.org
, Nov 1