-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Standardize handlers for settings view controllers.
Handler setup for settings view controllers was inconsistent. Most have access to a 'dispatcher' property that combines Application, Browser, and BrowsingData commands. This property is defined in the SettingsRootViewControlling property that most of these view controllers conform to by virtue of being subclasses of SettingsRootTableView-Controller. Others also have a separate property for Snackbar commands, and some have an additional Application commands handler, even though that can be done through the Dispatcher. Command injection was also heterogenous; the dispatcher property was typically set in the various convenience initializers of Settings NavigationController via various methods of the delegate protocol, even though all of these initializers also pass a Browser which provides a command dispatcher that can be used for all of these handlers. SettingsNavigationControllerDelegate defined three methods for fetching command handlers. One got the three-command 'handler for settings', one got just an Application command handler, and one got the Snackbar handler. Some implementations of this protocol had one or more of these methods as no-ops with NOTREACHED(); this is not something that should ever be done in a protocol (where parts of the API can just be makred @optional if they are actually optional). This CL standardizes things by: - Defining separate handler properties for all command protocols in SettingsRootViewControlling. - Getting rid of the mis-named 'dispatcher' property. - Setting handlers on view controllers based on the Browser that SettingsNavigationController is initialized with, and removing the handler fetching methods from that class's delegate protocol. - Ensuring all handlers are set for all view controllers. Some utility functions/methods are added to make this less boilerplate-y, although coordinators do use the same chunk of setup code to set all of the handlers on their view controllers. Tests are updated to configure command dispatch correctly. After this CL lands, follow-up CLs will prune some of these command protocols from SettingsRootViewControlling, to remove unneeded dependencies. Bug: 1045047 Change-Id: I4bdcda997763170595e2416df39575cc7b9e33cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4895672 Reviewed-by: Gauthier Ambard <gambard@chromium.org> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Commit-Queue: Mark Cogan <marq@chromium.org> Cr-Commit-Position: refs/heads/main@{#1210137}
- Loading branch information
Showing
34 changed files
with
313 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.