#include "chrome/browser/ui/views/content_setting_bubble_contents.h"
#include <algorithm>
#include <memory>
#include <utility>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/content_setting_site_row_view.h"
#include "chrome/browser/ui/views/controls/rich_hover_button.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.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/models/image_model.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/view_class_properties.h"
namespace {
ManageTextStyle;
std::u16string GetDoneButtonText(
const ContentSettingBubbleModel::BubbleContent& content) { … }
std::u16string GetCancelButtonText(
const ContentSettingBubbleModel::BubbleContent& content) { … }
ui::ImageModel GetSiteSettingsIcon() { … }
ui::ImageModel GetLaunchIcon() { … }
bool ShouldShowManageButton(
const ContentSettingBubbleModel::BubbleContent& content) { … }
enum class LayoutRowType { … };
struct LayoutRow { … };
}
class ContentSettingBubbleContents::ListItemContainer : public views::View { … };
ContentSettingBubbleContents::ListItemContainer::ListItemContainer(
ContentSettingBubbleContents* parent)
: … { … }
void ContentSettingBubbleContents::ListItemContainer::AddItem(
const ContentSettingBubbleModel::ListItem& item) { … }
void ContentSettingBubbleContents::ListItemContainer::RemoveRowAtIndex(
int index) { … }
void ContentSettingBubbleContents::ListItemContainer::ResetLayout() { … }
void ContentSettingBubbleContents::ListItemContainer::AddRowToLayout(
const Row& row) { … }
ContentSettingBubbleContents::ListItemContainer::Row
ContentSettingBubbleContents::ListItemContainer::AddNewRowToLayout(NewRow row) { … }
void ContentSettingBubbleContents::ListItemContainer::UpdateScrollHeight(
const Row& row) { … }
BEGIN_METADATA(…)
END_METADATA
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ContentSettingBubbleContents,
kMainElementId);
ContentSettingBubbleContents::ContentSettingBubbleContents(
std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model,
content::WebContents* web_contents,
views::View* anchor_view,
views::BubbleBorder::Arrow arrow)
: … { … }
ContentSettingBubbleContents::~ContentSettingBubbleContents() { … }
void ContentSettingBubbleContents::WindowClosing() { … }
void ContentSettingBubbleContents::OnListItemAdded(
const ContentSettingBubbleModel::ListItem& item) { … }
void ContentSettingBubbleContents::OnListItemRemovedAt(int index) { … }
int ContentSettingBubbleContents::GetSelectedRadioOption() { … }
void ContentSettingBubbleContents::OnThemeChanged() { … }
std::u16string ContentSettingBubbleContents::GetWindowTitle() const { … }
bool ContentSettingBubbleContents::ShouldShowCloseButton() const { … }
void ContentSettingBubbleContents::Init() { … }
void ContentSettingBubbleContents::StyleLearnMoreButton() { … }
std::unique_ptr<views::View>
ContentSettingBubbleContents::CreateHelpAndManageView() { … }
void ContentSettingBubbleContents::LinkClicked(int row,
const ui::Event& event) { … }
void ContentSettingBubbleContents::CustomLinkClicked() { … }
void ContentSettingBubbleContents::PrimaryPageChanged(content::Page& page) { … }
void ContentSettingBubbleContents::OnVisibilityChanged(
content::Visibility visibility) { … }
void ContentSettingBubbleContents::WebContentsDestroyed() { … }
BEGIN_METADATA(…)