feat: add support for DesktopCapturerSource.appIcon

Useful to get the icon of the application owning the source.
Only available for sources of type window, i.e. not for screen.

https://github.com/electron/electron/issues/14845
This commit is contained in:
Julien Isorce 2018-12-03 22:42:49 -08:00 committed by Cheng Zhao
parent 77f73830e8
commit 1f55f1635f
7 changed files with 48 additions and 15 deletions

View file

@ -25,6 +25,9 @@ class DesktopCapturer : public mate::EventEmitter<DesktopCapturer>,
DesktopMediaList::Source media_list_source;
// Will be an empty string if not available.
std::string display_id;
// Whether or not this source should provide an icon.
bool fetch_icon = false;
};
static mate::Handle<DesktopCapturer> Create(v8::Isolate* isolate);
@ -34,7 +37,8 @@ class DesktopCapturer : public mate::EventEmitter<DesktopCapturer>,
void StartHandling(bool capture_window,
bool capture_screen,
const gfx::Size& thumbnail_size);
const gfx::Size& thumbnail_size,
bool fetch_window_icons);
protected:
explicit DesktopCapturer(v8::Isolate* isolate);
@ -59,6 +63,7 @@ class DesktopCapturer : public mate::EventEmitter<DesktopCapturer>,
std::vector<DesktopCapturer::Source> captured_sources_;
bool capture_window_ = false;
bool capture_screen_ = false;
bool fetch_window_icons_ = false;
#if defined(OS_WIN)
bool using_directx_capturer_ = false;
#endif // defined(OS_WIN)