#include "chrome/browser/ui/views/passwords/manage_passwords_details_view.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/layout_constants.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/controls/rich_hover_button.h"
#include "chrome/browser/ui/views/passwords/manage_passwords_view_ids.h"
#include "chrome/browser/ui/views/passwords/password_bubble_view_base.h"
#include "chrome/browser/ui/views/passwords/views_utils.h"
#include "chrome/grit/generated_resources.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_ui_utils.h"
#include "components/password_manager/core/browser/ui/credential_ui_entry.h"
#include "components/password_manager/core/common/password_manager_constants.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/clipboard/scoped_clipboard_writer.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/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/textarea/textarea.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/vector_icons.h"
namespace {
ManagePasswordsViewIDs;
PasswordManagementBubbleInteractions;
constexpr int kIconSize = …;
constexpr int kDetailRowHeight = …;
constexpr int kMaxLinesVisibleFromPasswordNote = …;
void WriteToClipboard(const std::u16string& text, bool is_confidential) { … }
gfx::Insets ComputeRowMargins() { … }
std::unique_ptr<views::View> CreateIconView(
const gfx::VectorIcon& vector_icon) { … }
std::unique_ptr<views::Label> CreateErrorLabel(std::u16string error_msg) { … }
void AlignTextfieldWithRowIcon(views::Textfield* textfield) { … }
void AlignErrorLabelWithTextFieldContents(views::Label* error_label) { … }
std::unique_ptr<views::View> CreateWrappedView(
std::unique_ptr<views::View> child_view) { … }
std::unique_ptr<views::FlexLayoutView> CreateDetailsRow(
const gfx::VectorIcon& row_icon,
std::unique_ptr<views::View> detail_view) { … }
std::unique_ptr<views::View> CreateDetailsRowWithActionButton(
const gfx::VectorIcon& row_icon,
std::unique_ptr<views::View> detail_view,
const gfx::VectorIcon& action_icon,
const std::u16string& action_button_tooltip_text,
views::Button::PressedCallback action_button_callback,
ManagePasswordsViewIDs action_button_id) { … }
std::unique_ptr<views::View> CreatePasswordLabelWithEyeIconView(
std::unique_ptr<views::Label> password_label,
base::RepeatingClosure on_eye_icon_clicked) { … }
class NoteLabel : public views::Label { … };
std::unique_ptr<views::View> CreateNoteLabel(
const password_manager::PasswordForm& form) { … }
std::unique_ptr<views::View> CreateEditUsernameRow(
const password_manager::PasswordForm& form,
raw_ptr<views::Textfield>* textfield,
raw_ptr<views::Label>* error_label) { … }
std::unique_ptr<views::View> CreateEditNoteRow(
const password_manager::PasswordForm& form,
raw_ptr<views::Textarea>* textarea,
raw_ptr<views::Label>* error_label) { … }
std::unique_ptr<RichHoverButton> CreateManagePasswordRow(
base::RepeatingClosure on_manage_password_clicked_callback) { … }
}
std::unique_ptr<views::View> ManagePasswordsDetailsView::CreateTitleView(
const password_manager::PasswordForm& password_form,
std::optional<base::RepeatingClosure> on_back_clicked_callback) { … }
ManagePasswordsDetailsView::ManagePasswordsDetailsView(
password_manager::PasswordForm password_form,
bool allow_empty_username_edit,
base::RepeatingCallback<bool(const std::u16string&)>
username_exists_callback,
base::RepeatingClosure switched_to_edit_mode_callback,
base::RepeatingClosure on_activity_callback,
base::RepeatingCallback<void(bool)> on_input_validation_callback,
base::RepeatingClosure on_manage_password_clicked_callback)
: … { … }
ManagePasswordsDetailsView::~ManagePasswordsDetailsView() = default;
void ManagePasswordsDetailsView::SwitchToReadingMode() { … }
std::optional<std::u16string>
ManagePasswordsDetailsView::GetUserEnteredUsernameValue() const { … }
std::optional<std::u16string>
ManagePasswordsDetailsView::GetUserEnteredPasswordNoteValue() const { … }
void ManagePasswordsDetailsView::SwitchToEditUsernameMode() { … }
void ManagePasswordsDetailsView::SwitchToEditNoteMode() { … }
void ManagePasswordsDetailsView::OnUserInputChanged() { … }
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ManagePasswordsDetailsView, kTopView);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ManagePasswordsDetailsView, kBackButton);
BEGIN_METADATA(…)