#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/password_manager/password_manager_ui.h"
#include "base/feature_list.h"
#include "base/i18n/message_formatter.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/extension_control_handler.h"
#include "chrome/browser/ui/webui/favicon_source.h"
#include "chrome/browser/ui/webui/managed_ui_handler.h"
#include "chrome/browser/ui/webui/password_manager/promo_card.h"
#include "chrome/browser/ui/webui/password_manager/promo_cards_handler.h"
#include "chrome/browser/ui/webui/password_manager/sync_handler.h"
#include "chrome/browser/ui/webui/plural_string_handler.h"
#include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h"
#include "chrome/browser/ui/webui/sanitized_image_source.h"
#include "chrome/browser/ui/webui/settings/safety_hub_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/password_manager_resources.h"
#include "chrome/grit/password_manager_resources_map.h"
#include "chrome/grit/theme_resources.h"
#include "components/favicon_base/favicon_url_parser.h"
#include "components/grit/components_scaled_resources.h"
#include "components/password_manager/content/common/web_ui_constants.h"
#include "components/password_manager/core/browser/features/password_features.h"
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#include "components/password_manager/core/common/password_manager_constants.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/base/features.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "device/fido/features.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
#include "components/password_manager/core/browser/password_manager_util.h"
#endif
#if !BUILDFLAG(OPTIMIZE_WEBUI)
#include "chrome/grit/settings_shared_resources.h"
#include "chrome/grit/settings_shared_resources_map.h"
#endif
namespace {
std::u16string InsertBrandedPasswordManager(int message_id) { … }
content::WebUIDataSource* CreateAndAddPasswordsUIHTMLSource(
Profile* profile,
content::WebUI* web_ui) { … }
void AddPluralStrings(content::WebUI* web_ui) { … }
}
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PasswordManagerUI,
kSettingsMenuItemElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PasswordManagerUI, kAddShortcutElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PasswordManagerUI,
kOverflowMenuElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PasswordManagerUI,
kSharePasswordElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PasswordManagerUI,
kAccountStoreToggleElementId);
DEFINE_CLASS_CUSTOM_ELEMENT_EVENT_TYPE(PasswordManagerUI,
kAddShortcutCustomEventId);
PasswordManagerUI::PasswordManagerUI(content::WebUI* web_ui)
: … { … }
PasswordManagerUI::~PasswordManagerUI() = default;
base::RefCountedMemory* PasswordManagerUI::GetFaviconResourceBytes(
ui::ResourceScaleFactor scale_factor) { … }
WEB_UI_CONTROLLER_TYPE_IMPL(PasswordManagerUI)
void PasswordManagerUI::BindInterface(
mojo::PendingReceiver<help_bubble::mojom::HelpBubbleHandlerFactory>
pending_receiver) { … }
void PasswordManagerUI::CreateHelpBubbleHandler(
mojo::PendingRemote<help_bubble::mojom::HelpBubbleClient> client,
mojo::PendingReceiver<help_bubble::mojom::HelpBubbleHandler> handler) { … }