#include "chrome/browser/ui/views/passwords/password_generation_popup_view_views.h"
#include <algorithm>
#include <memory>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/passwords/password_generation_popup_controller.h"
#include "chrome/browser/ui/passwords/ui_utils.h"
#include "chrome/browser/ui/views/accessibility/non_accessible_image_view.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/passwords/views_utils.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/password_manager/core/browser/features/password_features.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/focus_ring.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/vector_icons.h"
#include "ui/views/widget/widget.h"
namespace {
PasswordGenerationVariation;
constexpr int kPasswordGenerationMaxWidth = …;
constexpr int kIconSize = …;
void AddSpacerWithSize(int spacer_width, bool resize, views::View* view) { … }
int GetHelpTextMessageId() { … }
std::unique_ptr<views::FlexLayoutView> CreateLabelWithCheckIcon(
const std::u16string& label_text) { … }
std::unique_ptr<views::View> CreateCrossDeviceFooter(
const std::u16string& primary_account_email) { … }
std::unique_ptr<views::View> CreatePasswordLabelWithIcon() { … }
class NudgePasswordButtons : public views::View { … };
BEGIN_METADATA(…)
std::unique_ptr<views::View> CreateNudgePasswordView(
base::WeakPtr<PasswordGenerationPopupController> controller) { … }
}
class PasswordGenerationPopupViewViews::GeneratedPasswordBox
: public views::View { … };
void PasswordGenerationPopupViewViews::GeneratedPasswordBox::Init(
base::WeakPtr<PasswordGenerationPopupController> controller) { … }
void PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnMouseEntered(
const ui::MouseEvent& event) { … }
void PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnMouseExited(
const ui::MouseEvent& event) { … }
bool PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnMousePressed(
const ui::MouseEvent& event) { … }
void PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnMouseReleased(
const ui::MouseEvent& event) { … }
void PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnGestureEvent(
ui::GestureEvent* event) { … }
BEGIN_METADATA(…)
END_METADATA
PasswordGenerationPopupViewViews::PasswordGenerationPopupViewViews(
base::WeakPtr<PasswordGenerationPopupController> controller,
views::Widget* parent_widget)
: … { … }
PasswordGenerationPopupViewViews::~PasswordGenerationPopupViewViews() = default;
bool PasswordGenerationPopupViewViews::Show() { … }
void PasswordGenerationPopupViewViews::Hide() { … }
void PasswordGenerationPopupViewViews::UpdateState() { … }
void PasswordGenerationPopupViewViews::UpdateGeneratedPasswordValue() { … }
bool PasswordGenerationPopupViewViews::UpdateBoundsAndRedrawPopup() { … }
void PasswordGenerationPopupViewViews::PasswordSelectionUpdated() { … }
void PasswordGenerationPopupViewViews::NudgePasswordSelectionUpdated() { … }
void PasswordGenerationPopupViewViews::CreateLayoutAndChildren() { … }
void PasswordGenerationPopupViewViews::GetAccessibleNodeData(
ui::AXNodeData* node_data) { … }
void PasswordGenerationPopupViewViews::UpdateExpandedCollapsedAccessibleState()
const { … }
gfx::Size PasswordGenerationPopupViewViews::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
PasswordGenerationPopupView* PasswordGenerationPopupView::Create(
base::WeakPtr<PasswordGenerationPopupController> controller) { … }
const views::ViewAccessibility&
PasswordGenerationPopupViewViews::GetPasswordViewViewAccessibilityForTest() { … }
int PasswordGenerationPopupViewViews::GetHelpTextMessageIdForTesting() const { … }
std::u16string
PasswordGenerationPopupViewViews::JoinMultiplePasswordGenerationStrings(
const std::u16string& help_text) { … }
BEGIN_METADATA(…)