#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/views/desktop_capture/share_this_tab_source_view.h"
#include "base/task/bind_post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_utils.h"
#include "chrome/browser/ui/views/desktop_capture/rounded_corner_image_view.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "media/base/video_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/layout/box_layout.h"
namespace {
constexpr int kPreviewWidth = …;
constexpr int kPreviewHeight = …;
constexpr int kPadding = …;
constexpr int kFaviconWidth = …;
constexpr int kFaviconTabTitleRowHeight = …;
constexpr gfx::Rect kPreviewRect(kPadding,
kPadding,
kPreviewWidth,
kPreviewHeight);
constexpr gfx::Rect kFaviconRect(kPadding,
kPreviewRect.bottom() + kPadding,
kFaviconWidth,
kFaviconTabTitleRowHeight);
constexpr gfx::Rect kTabTitleMaxRect(kFaviconRect.right() + kPadding,
kPreviewRect.bottom() + kPadding,
kPreviewWidth - kFaviconWidth - kPadding,
kFaviconTabTitleRowHeight);
constexpr base::TimeDelta kUpdatePeriodMs = …;
void HandleCapturedBitmap(
base::OnceCallback<void(uint32_t, const std::optional<gfx::ImageSkia>&)>
reply,
std::optional<uint32_t> last_hash,
gfx::Size thumbnail_size,
const SkBitmap& bitmap) { … }
}
ShareThisTabSourceView::ShareThisTabSourceView(
base::WeakPtr<content::WebContents> web_contents)
: … { … }
ShareThisTabSourceView::~ShareThisTabSourceView() = default;
void ShareThisTabSourceView::Activate() { … }
void ShareThisTabSourceView::StopRefreshing() { … }
gfx::Size ShareThisTabSourceView::CalculatePreferredSize(
const views::SizeBounds& ) const { … }
void ShareThisTabSourceView::UpdateFaviconAndTabTitle() { … }
void ShareThisTabSourceView::Refresh() { … }
void ShareThisTabSourceView::OnCaptureHandled(
uint32_t hash,
const std::optional<gfx::ImageSkia>& image) { … }
BEGIN_METADATA(…)