#include "chrome/browser/ui/views/webid/account_selection_view_base.h"
#include "base/functional/callback_forward.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/ui/views/controls/hover_button.h"
#include "chrome/browser/ui/views/webid/account_selection_bubble_view.h"
#include "chrome/grit/generated_resources.h"
#include "components/image_fetcher/core/image_decoder.h"
#include "components/image_fetcher/core/image_fetcher_impl.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/style/typography.h"
#include "ui/views/widget/widget_observer.h"
#include "url/gurl.h"
namespace {
constexpr float kMaskableWebIconSafeZoneRatio = …;
constexpr int kIdpBorderRadius = …;
int SelectDisclosureTextResourceId(const GURL& privacy_policy_url,
const GURL& terms_of_service_url) { … }
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
class LetterCircleCroppedImageSkiaSource : public gfx::CanvasImageSource { … };
class CircleCroppedImageSkiaSource : public gfx::CanvasImageSource { … };
gfx::ImageSkia CreateCircleCroppedImage(const gfx::ImageSkia& original_image,
int image_size) { … }
class AccountImageView : public views::ImageView { … };
BEGIN_METADATA(…)
class AccountHoverButton : public HoverButton { … };
}
BrandIconImageView::BrandIconImageView(
base::OnceCallback<void(const GURL&, const gfx::ImageSkia&)> add_image,
int image_size,
bool should_circle_crop,
std::optional<SkColor> background_color,
base::RepeatingClosure on_image_set)
: … { … }
BrandIconImageView::~BrandIconImageView() = default;
void BrandIconImageView::FetchImage(
const GURL& icon_url,
image_fetcher::ImageFetcher& image_fetcher) { … }
void BrandIconImageView::CropAndSetImage(const gfx::ImageSkia& original_image) { … }
void BrandIconImageView::OnImageFetched(
const GURL& image_url,
const gfx::Image& image,
const image_fetcher::RequestMetadata& metadata) { … }
void BrandIconImageView::OnBackgroundColorUpdated(
const SkColor& background_color) { … }
BEGIN_METADATA(…)
AccountSelectionViewBase::AccountSelectionViewBase(
content::WebContents* web_contents,
AccountSelectionViewBase::Observer* observer,
views::WidgetObserver* widget_observer,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::u16string rp_for_display)
: … { … }
AccountSelectionViewBase::AccountSelectionViewBase() = default;
AccountSelectionViewBase::~AccountSelectionViewBase() { … }
void AccountSelectionViewBase::OnOcclusionStateChanged(bool occluded) { … }
void AccountSelectionViewBase::SetLabelProperties(views::Label* label) { … }
std::unique_ptr<views::View> AccountSelectionViewBase::CreateAccountRow(
const content::IdentityRequestAccount& account,
const content::IdentityProviderData& idp_display_data,
std::optional<int> clickable_position,
bool should_include_idp,
bool is_modal_dialog,
int additional_vertical_padding,
std::optional<std::u16string> last_used_string) { … }
void AccountSelectionViewBase::AddIdpImage(const GURL& image_url,
const gfx::ImageSkia& image) { … }
void AccountSelectionViewBase::ConfigureBrandImageView(
BrandIconImageView* image_view,
const GURL& brand_icon_url) { … }
std::unique_ptr<views::StyledLabel>
AccountSelectionViewBase::CreateDisclosureLabel(
const content::IdentityProviderData& idp_display_data) { … }
base::WeakPtr<views::Widget> AccountSelectionViewBase::GetDialogWidget() { … }
net::NetworkTrafficAnnotationTag
AccountSelectionViewBase::GetTrafficAnnotation() { … }
bool AccountSelectionViewBase::CanFitInWebContents() { … }