#include "chrome/browser/ui/views/sharing/sharing_dialog_view.h"
#include <optional>
#include "base/functional/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/accessibility/theme_tracking_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/hover_button.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
#include "components/sharing_message/sharing_app.h"
#include "components/sharing_message/sharing_metrics.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/device_info.h"
#include "components/url_formatter/elide_url.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "url/origin.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/views/intent_picker_bubble_view.h"
#endif
namespace {
constexpr int kSharingDialogSpacing = …;
std::u16string GetLastUpdatedTimeInDays(base::Time last_updated_timestamp) { … }
bool ShouldShowOrigin(const SharingDialogData& data,
content::WebContents* web_contents) { … }
std::u16string PrepareHelpTextWithoutOrigin(const SharingDialogData& data) { … }
std::u16string PrepareHelpTextWithOrigin(const SharingDialogData& data) { … }
std::unique_ptr<views::View> CreateOriginView(const SharingDialogData& data) { … }
const gfx::VectorIcon& GetIconType(
const syncer::DeviceInfo::FormFactor& device_form_factor) { … }
}
SharingDialogView::SharingDialogView(views::View* anchor_view,
content::WebContents* web_contents,
SharingDialogData data)
: … { … }
SharingDialogView::~SharingDialogView() = default;
void SharingDialogView::Hide() { … }
bool SharingDialogView::ShouldShowCloseButton() const { … }
std::u16string SharingDialogView::GetWindowTitle() const { … }
void SharingDialogView::WindowClosing() { … }
void SharingDialogView::WebContentsDestroyed() { … }
void SharingDialogView::AddedToWidget() { … }
SharingDialogType SharingDialogView::GetDialogType() const { … }
void SharingDialogView::DeviceButtonPressed(size_t index) { … }
void SharingDialogView::AppButtonPressed(size_t index) { … }
views::BubbleDialogDelegateView* SharingDialogView::GetAsBubble(
SharingDialog* dialog) { … }
views::BubbleDialogDelegateView* SharingDialogView::GetAsBubbleForClickToCall(
SharingDialog* dialog) { … }
void SharingDialogView::Init() { … }
void SharingDialogView::InitListView() { … }
void SharingDialogView::InitErrorView() { … }
std::unique_ptr<views::StyledLabel> SharingDialogView::CreateHelpText() { … }