The popup classes in this directory are used to display the following types of data on Desktop platforms:
Additionally, PopupBaseView is also re-used for the popup in which password generation prompts are rendered.
The main classes for the popup have the following hierarchy:
┌───────────────────────┐ │ PopupBaseView │ └──▲────────────────────┘ │ extends ┌──┴────────────────────┐ │ PopupViewViews │ └──┬────────────────────┘ │owns N ┌──▼────────────────────┐ owns 1 ┌────────────────────┐ │ PopupRowView ├────────► PopupRowStrategy │ └──┬────────────────────┘ └────┬───────────────┘ │owns 1 or 2 │ ┌──▼────────────────────┐ creates │ │ PopupCellView ◄─────────────┘ └───────────────────────┘
These classes serve the following purposes:
PopupBaseView: Serves as the common base class for both PopupViewViews and PasswordGenerationPopupViewViews.PopupViewViews: Implements the AutofillPopupView interface that the AutofillPopupController interacts with.ScrollView). Rows with selectable cells are represented by PopupRowView, but PopupViewViews can also contain rows that cannot be selected (e.g. a PopupSeparatorView).PopupRowView: Represents a single row in a PopupViewViews that has selectable cells.PopupCellView) and it renders them next to each other. The first cell is the “content” cell; the optional second cell is a “control” cell, e.g. for displaying a delete button.PopupRowStrategy that it uses to create the contained cells at construction time.PopupCellView: Represents the smallest selectable element in a popup, a cell.PopupRowStrategy can add arbitrary content to it.PopupRowStrategy: Acts as an interface to create PopupCellViews for different types of popup entries. It is passed to PopupRowView at construction. The classes that extend it (e.g. a PopupPasswordSuggestionStrategy) add content to the cell view and set the proper callbacks to the cell view for processing selection and click events.There are currently about ~30 different PopupItemIds, that correspond to a different type of popup row. When a new type is added and it cannot be properly processed by an existing PopupRowStrategy, use the following steps to support it by the popup UI:
PopupRowStrategy:PopupCellView that CreateContent() or CreateControl() create - it behaves as any other container view.PopupCellView exposes. For example, you can call PopupCellView::SetOnAcceptedCallback(base::RepeatingClosure) to set the behavior for accepting a cell.PopupRowView::Create to pass the new strategy when the Suggestion's frontend_id has the relevant PopupItemId.popup_row_strategy_unittest.cc to test the accessibility and selection behavior of the cells and to popup_view_views_browsertest.cc to add pixel tests.