Refactor DownloadItemView state transitions, part 5.
* Moves calls to UpdateAccessibleName() into UpdateMode(). The unconditional call in OnDownloadUpdated() is now effectively called earlier, and conditionally, but it only had an effect in a subset of the cases where UpdateMode() is called, and is unrelated to the things that change in the meantime*, so this is fine. *Except: The other existing call in GetInProgressAccessibleAlertText() was necessary to ensure this _was_ updated in time in that case, and now that it's done earlier, is no longer needed. * Inlines the contents of UpdateAccessibleName() since it's now only called once. * Adds a new helper, UpdateAccessibleAlertAndTimersForNormalMode(), which handles everything UpdateMode() was doing specifically for the kNormal case. Refactors the existing switch significantly to reduce duplication. * Removes a call to StopDownloadProgress() from the destructor which had no effect (since the timers were about to be deleted anyway). * Inlines StartDownloadProgress() and StopDownloadProgress() into the new helper since they're now each only called once. * Sets up parameters for various timers in the constructor so this helper can largely just Reset() them to start them. * Inlines ProgressTimerFired() as a lambda into the progress timer constructor. * Renames various timer-related members in hopes of greater clarity. Bug: none Change-Id: Ida6a1f9d607d95f190be3908d7639de8bd515990 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2301209 Auto-Submit: Peter Kasting <pkasting@chromium.org> Commit-Queue: Min Qin <qinmin@chromium.org> Reviewed-by:Min Qin <qinmin@chromium.org> Cr-Commit-Position: refs/heads/master@{#789535}
Showing
This diff is collapsed.
Please register or sign in to comment