#include "chrome/browser/ui/views/webid/account_selection_modal_view.h"
#include <iostream>
#include <memory>
#include <optional>
#include <utility>
#include "base/barrier_closure.h"
#include "base/functional/bind.h"
#include "base/i18n/case_conversion.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/accessibility/accessibility_state_utils.h"
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/ui/monogram_utils.h"
#include "chrome/browser/ui/views/controls/hover_button.h"
#include "chrome/browser/ui/views/webid/account_selection_view_base.h"
#include "chrome/browser/ui/views/webid/fedcm_account_selection_view_desktop.h"
#include "chrome/browser/ui/views/webid/webid_utils.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/image_fetcher/core/image_fetcher_impl.h"
#include "components/strings/grit/components_strings.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/identity_request_dialog_controller.h"
#include "content/public/browser/web_contents.h"
#include "skia/ext/image_operations.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/progress_bar.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/separator.h"
#include "ui/views/controls/styled_label.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/flex_layout_view.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/style/typography.h"
#include "ui/views/view_class_properties.h"
constexpr int kBetweenChildSpacing = …;
constexpr int kVerticalPadding = …;
constexpr int kDialogWidth = …;
constexpr int kDialogMargin = …;
class BackgroundImageView : public views::ImageView { … };
BEGIN_METADATA(…)
AccountSelectionModalView::AccountSelectionModalView(
const std::u16string& rp_for_display,
const std::optional<std::u16string>& idp_title,
blink::mojom::RpContext rp_context,
content::WebContents* web_contents,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
AccountSelectionViewBase::Observer* observer,
views::WidgetObserver* widget_observer)
: … { … }
AccountSelectionModalView::~AccountSelectionModalView() = default;
void AccountSelectionModalView::AddProgressBar() { … }
void AccountSelectionModalView::UpdateDialogPosition() { … }
void AccountSelectionModalView::InitDialogWidget() { … }
std::unique_ptr<views::View>
AccountSelectionModalView::CreatePlaceholderAccountRow() { … }
std::unique_ptr<views::View> AccountSelectionModalView::CreateButtonRow(
std::optional<views::Button::PressedCallback> continue_callback =
std::nullopt,
std::optional<views::Button::PressedCallback> use_other_account_callback =
std::nullopt,
std::optional<views::Button::PressedCallback> back_callback =
std::nullopt) { … }
std::unique_ptr<views::View> AccountSelectionModalView::CreateHeader() { … }
std::unique_ptr<views::View>
AccountSelectionModalView::CreateMultipleAccountChooser(
const std::vector<content::IdentityProviderData>& idp_data_list) { … }
void AccountSelectionModalView::ShowMultiAccountPicker(
const std::vector<content::IdentityProviderData>& idp_data_list,
bool show_back_button,
bool is_choose_an_account) { … }
void AccountSelectionModalView::ShowVerifyingSheet(
const content::IdentityRequestAccount& account,
const content::IdentityProviderData& idp_display_data,
const std::u16string& title) { … }
std::unique_ptr<views::View>
AccountSelectionModalView::CreateSingleAccountChooser(
const content::IdentityProviderData& idp_display_data,
const content::IdentityRequestAccount& account,
bool should_hover,
bool show_disclosure_label,
bool show_separator,
int additional_row_vertical_padding) { … }
void AccountSelectionModalView::ShowSingleAccountConfirmDialog(
const content::IdentityRequestAccount& account,
const content::IdentityProviderData& idp_display_data,
bool show_back_button) { … }
void AccountSelectionModalView::ShowFailureDialog(
const std::u16string& idp_for_display,
const content::IdentityProviderMetadata& idp_metadata) { … }
void AccountSelectionModalView::ShowErrorDialog(
const std::u16string& idp_for_display,
const content::IdentityProviderMetadata& idp_metadata,
const std::optional<TokenError>& error) { … }
void AccountSelectionModalView::ShowLoadingDialog() { … }
void AccountSelectionModalView::OnCombinedIconsFetched() { … }
void AccountSelectionModalView::ShowRequestPermissionDialog(
const content::IdentityRequestAccount& account,
const content::IdentityProviderData& idp_display_data) { … }
void AccountSelectionModalView::ShowSingleReturningAccountDialog(
const std::vector<content::IdentityProviderData>& idp_data_list) { … }
std::unique_ptr<views::View> AccountSelectionModalView::CreateIconHeaderView() { … }
std::unique_ptr<views::BoxLayoutView>
AccountSelectionModalView::CreateIdpIconView() { … }
std::unique_ptr<views::BoxLayoutView>
AccountSelectionModalView::CreateCombinedIconsView() { … }
void AccountSelectionModalView::CloseDialog() { … }
std::string AccountSelectionModalView::GetDialogTitle() const { … }
std::u16string AccountSelectionModalView::GetQueuedAnnouncementForTesting() { … }
views::View* AccountSelectionModalView::GetInitiallyFocusedView() { … }
void AccountSelectionModalView::RemoveNonHeaderChildViews() { … }
void AccountSelectionModalView::MaybeRemoveCombinedIconsView() { … }
BEGIN_METADATA(…)