views: rework DialogDelegate button customization
There are a handful of dialogs that need to customize parts of the DialogClientView or BubbleFrameView that DialogDelegate creates internally. Currently, that customization is achieved by overriding DialogDelegate::UpdateButton(), which is called "whenever needed" by DialogClientView. This change reworks that logic. Specifically, this change: 1) Adds a virtual method DialogDelegate::OnDialogInitialized() which is called after the DialogDelegate's frame, widget, etc are all initialized but not yet shown. This will be the new customization point for DialogDelegate subclasses that need to customize these elements. 2) Adds a virtual method WidgetDelegate::OnWidgetInitialized() which is called after Widget::Init is complete. DialogDelegate uses this to call OnDialogInitialized at the proper point. 3) Adds some accessors to DialogDelegate to make getting at the buttons in the DialogClientView easier (and make users of DialogDelegate not need to know about DialogClientView, which should be an implementation detail). 4) Removes DialogDelegate::UpdateButton, which is now superfluous, and folds the body of the old base implementation into DialogClientView where it belongs. 5) Removes some of the GlobalErrorBubbleViewTest suite, which were "change detector" unit tests for the internals of DialogDelegate. OnDialogInitialized is also a logical place to move some of the other customizations of DialogDelegate that are currently done via other hooks (e.g. CreateExtraView and friends); this will happen in a followup change. This is why DialogDelegate has OnDialogInitialized rather than encouraging subclasses to directly override WidgetDelegate::OnWidgetInitialized: soon it will be necessary for DialogDelegate to do its own setup in OnWidgetInitialized, and I want to maintain the "contractless" behavior of OnDialogInitialized. Bug: 1011446 Change-Id: I9a9a24aa077cd62fb219b8104267c5d6ab6edb40 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865410 Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org> Reviewed-by:Robert Liao <robliao@chromium.org> Cr-Commit-Position: refs/heads/master@{#706754}
Showing
Please register or sign in to comment