[iOS] Remove TabModel Notifications (2/3) -- StackView
This CL removes kTabModelAllTabsDidCloseNotification, one of the two remaining TabModel
notifications. StackViewController was its only observer.
This CL moves the notification into a TabModelObserver method. Since StackViewController isn't
a TabModelObserver itself, a method is added to CardSetObserver (since the card sets are the
objects that observe the tab models in the stack view).
Prior to this CL, the flow of events when closing all tabs in the stack view was:
[1] The card set whose cards are being deleted (in removeAllCardsFromSet:) calls
[cardSet setIgnoresTabModelChanges:YES].
[2] The cards are animated out
[3] A completion handler is called when the animation completes; it calls -closeAllTabs on the
cardSet's TabModel.
[4] The tab model deletes the tabs and sends the kTabModelAllTabsDidCloseNotification
[5] StackViewController catches the notification and calls -allModelTabsHaveClosed:, which in
turn sets [cardSet setIgnoresTabModelChanges:NO]
It's important to note that [cardSet setIgnoresTabModelChanges:NO] removes |cardSet| as a
TabModelObserver. Functionally in this flow, tab model observation is disabled, then the
notification is used to bypass the disabled observation and to signal that observation should be
reenabled.
After this CL some of the steps in the above flow are changed:
[3] A completion handler is called when the animation completes; it calls
[cardSet setIgnoresTabModelChanges:NO] and then -closeAllTabs on the cardSet's TabModel.
[4] The tab model deletes the tabs and tells its observers.
[5] CardSet (a TabModelObserver) gets the -tabModelClosedAllTabs call and sends its observer
a cardSetDidCloseAllTabs: method.
[6] StackViewController gets the cardSetDidCloseAllTabs: call and handles the cleanup.
Bug: 320877
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I98ac82d272d696f2182aa54c5b603cf6c737e073
Reviewed-on: https://chromium-review.googlesource.com/847004
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by:
Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526656}
Showing
Please register or sign in to comment