From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 18 Oct 2018 17:07:01 -0700 Subject: desktop_media_list.patch * Use our grit resources instead of the chrome ones. * Disabled WindowCaptureMacV2 feature for https://github.com/electron/electron/pull/30507 * Ensure "OnRefreshComplete()" even if there are no items in the list diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h index 57cfc646f8ea545271c22d79ec158a04b148bc9c..db4d608d3bed841ddf7225d0918e82112c8d08b5 100644 --- a/chrome/browser/media/webrtc/desktop_media_list.h +++ b/chrome/browser/media/webrtc/desktop_media_list.h @@ -94,7 +94,7 @@ class DesktopMediaList { // once per DesktopMediaList instance. It should not be called after // StartUpdating(), and StartUpdating() should not be called until |callback| // has been called. - virtual void Update(UpdateCallback callback) = 0; + virtual void Update(UpdateCallback callback, bool fetch_thumbnails = false) = 0; virtual int GetSourceCount() const = 0; virtual const Source& GetSource(int index) const = 0; diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.cc b/chrome/browser/media/webrtc/desktop_media_list_base.cc index 24bd95b79479c21182a0d1a61364e1794f900261..2b2a7494ee9bd88fd5c8ebf50a5e29738b2dffd0 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.cc +++ b/chrome/browser/media/webrtc/desktop_media_list_base.cc @@ -63,12 +63,12 @@ void DesktopMediaListBase::StartUpdating(DesktopMediaListObserver* observer) { Refresh(true); } -void DesktopMediaListBase::Update(UpdateCallback callback) { +void DesktopMediaListBase::Update(UpdateCallback callback, bool refresh_thumbnails) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(sources_.empty()); DCHECK(!refresh_callback_); refresh_callback_ = std::move(callback); - Refresh(false); + Refresh(refresh_thumbnails); } int DesktopMediaListBase::GetSourceCount() const { diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.h b/chrome/browser/media/webrtc/desktop_media_list_base.h index 98cc4e039ba2b5a467175b15650a7b8ef38e8249..f5aea6a5916b9aa56ee7b81a8de97dc44e04a759 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.h +++ b/chrome/browser/media/webrtc/desktop_media_list_base.h @@ -35,7 +35,7 @@ class DesktopMediaListBase : public DesktopMediaList { void SetThumbnailSize(const gfx::Size& thumbnail_size) override; void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; void StartUpdating(DesktopMediaListObserver* observer) override; - void Update(UpdateCallback callback) override; + void Update(UpdateCallback callback, bool refresh_thumbnails) override; int GetSourceCount() const override; const Source& GetSource(int index) const override; DesktopMediaList::Type GetMediaListType() const override; diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc index f777d8e6aa8a36d273a1a23f5e71390fad7e434f..c59706f0e244afa9408a5bfeaf5a51ad10c1f885 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -16,7 +16,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/media/webrtc/desktop_media_list.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_features.h" @@ -94,8 +94,9 @@ gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr frame, } #if defined(OS_MAC) +// Refs https://github.com/electron/electron/pull/30507 const base::Feature kWindowCaptureMacV2{"WindowCaptureMacV2", - base::FEATURE_ENABLED_BY_DEFAULT}; + base::FEATURE_DISABLED_BY_DEFAULT}; #endif } // namespace @@ -427,6 +428,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows( FROM_HERE, base::BindOnce(&Worker::RefreshThumbnails, base::Unretained(worker_.get()), std::move(native_ids), thumbnail_size_)); + } else { +#if defined(USE_AURA) + pending_native_thumbnail_capture_ = true; +#endif + UpdateNativeThumbnailsFinished(); } }