#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/media/webrtc/current_tab_desktop_media_list.h"
#include "base/functional/bind.h"
#include "base/hash/hash.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_utils.h"
#include "content/public/browser/browser_task_traits.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 "content/public/browser/web_contents.h"
#include "media/base/video_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkImage.h"
namespace {
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) { … }
}
CurrentTabDesktopMediaList ::CurrentTabDesktopMediaList(
content::WebContents* web_contents)
: … { … }
CurrentTabDesktopMediaList::CurrentTabDesktopMediaList(
content::WebContents* web_contents,
base::TimeDelta period,
DesktopMediaListObserver* observer)
: … { … }
CurrentTabDesktopMediaList::~CurrentTabDesktopMediaList() = default;
void CurrentTabDesktopMediaList::Refresh(bool update_thumbnails) { … }
void CurrentTabDesktopMediaList::OnCaptureHandled(
uint32_t hash,
const std::optional<gfx::ImageSkia>& image) { … }
void CurrentTabDesktopMediaList::ResetLastHashForTesting() { … }