#include "chrome/browser/ui/views/autofill/popup/popup_cell_utils.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/branding_buildflags.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/passwords/ui_utils.h"
#include "chrome/browser/ui/views/autofill/popup/popup_base_view.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_content_view.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_view.h"
#include "chrome/browser/ui/views/autofill/popup/popup_view_utils.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "components/autofill/core/browser/filling_product.h"
#include "components/autofill/core/browser/ui/autofill_resource_utils.h"
#include "components/autofill/core/browser/ui/suggestion.h"
#include "components/autofill/core/browser/ui/suggestion_type.h"
#include "components/omnibox/browser/vector_icons.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/image_model_utils.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider_manager.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/view_class_properties.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/table_layout_view.h"
#include "ui/views/view.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "components/plus_addresses/resources/vector_icons.h"
#endif
namespace autofill::popup_cell_utils {
namespace {
constexpr int kIconSize = …;
constexpr int kChromeRefreshIconSize = …;
constexpr int kAutofillPopupAdditionalDoubleRowHeight = …;
constexpr int kAutofillPopupAdditionalVerticalPadding = …;
constexpr int kAdjacentLabelsVerticalSpacing = …;
constexpr int kGooglePasswordManagerIconSize = …;
constexpr char kHistogramGetImageViewByName[] = …;
std::u16string GetIconAccessibleName(Suggestion::Icon icon) { … }
std::optional<ui::ImageModel> ImageModelFromImageSkia(
const gfx::ImageSkia& image_skia) { … }
std::unique_ptr<views::ImageView> ConvertModelToImageView(
std::optional<ui::ImageModel> image_model,
bool apply_deactivated_style) { … }
}
std::optional<ui::ImageModel> GetIconImageModelFromIcon(Suggestion::Icon icon) { … }
std::u16string GetVoiceOverStringFromSuggestion(const Suggestion& suggestion) { … }
gfx::Insets GetMarginsForContentCell() { … }
std::unique_ptr<views::ImageView> GetIconImageView(
const Suggestion& suggestion) { … }
std::unique_ptr<views::ImageView> GetTrailingIconImageView(
const Suggestion& suggestion) { … }
void AddSpacerWithSize(views::View& view,
views::BoxLayout& layout,
int spacer_width,
bool resize) { … }
void AddSuggestionContentTableToView(
std::unique_ptr<views::Label> main_text_label,
std::unique_ptr<views::Label> minor_text_label,
std::unique_ptr<views::Label> description_label,
std::vector<std::unique_ptr<views::View>> subtext_views,
PopupRowContentView& content_view) { … }
void AddSuggestionContentToView(
const Suggestion& suggestion,
std::unique_ptr<views::Label> main_text_label,
std::unique_ptr<views::Label> minor_text_label,
std::unique_ptr<views::Label> description_label,
std::vector<std::unique_ptr<views::View>> subtext_views,
std::unique_ptr<views::View> icon,
PopupRowContentView& content_view) { … }
ui::ImageModel ImageModelFromVectorIcon(const gfx::VectorIcon& vector_icon,
int icon_size = kIconSize) { … }
const gfx::VectorIcon& GetExpandableMenuIcon(SuggestionType type) { … }
}