diff --git a/shell/browser/api/atom_api_web_contents.cc b/shell/browser/api/atom_api_web_contents.cc index 2a8b232fcca83..42bad014a8987 100644 --- a/shell/browser/api/atom_api_web_contents.cc +++ b/shell/browser/api/atom_api_web_contents.cc @@ -2215,6 +2215,31 @@ v8::Local WebContents::CapturePage(gin_helper::Arguments* args) { return handle; } +void WebContents::IncrementCapturerCount(gin_helper::Arguments* args) { + gfx::Size size; + bool stay_hidden = false; + + // get rect arguments if they exist + args->GetNext(&size); + // get stay_hidden arguments if they exist + args->GetNext(&stay_hidden); + + web_contents()->IncrementCapturerCount(size, stay_hidden); +} + +void WebContents::DecrementCapturerCount(gin_helper::Arguments* args) { + bool stay_hidden = false; + + // get stay_hidden arguments if they exist + args->GetNext(&stay_hidden); + + web_contents()->DecrementCapturerCount(stay_hidden); +} + +bool WebContents::IsBeingCaptured() { + return web_contents()->IsBeingCaptured(); +} + void WebContents::OnCursorChange(const content::WebCursor& cursor) { const content::CursorInfo& info = cursor.info(); @@ -2591,6 +2616,9 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("setEmbedder", &WebContents::SetEmbedder) .SetMethod("setDevToolsWebContents", &WebContents::SetDevToolsWebContents) .SetMethod("getNativeView", &WebContents::GetNativeView) + .SetMethod("incrementCapturerCount", &WebContents::IncrementCapturerCount) + .SetMethod("decrementCapturerCount", &WebContents::DecrementCapturerCount) + .SetMethod("isBeingCaptured", &WebContents::IsBeingCaptured) .SetMethod("setWebRTCIPHandlingPolicy", &WebContents::SetWebRTCIPHandlingPolicy) .SetMethod("getWebRTCIPHandlingPolicy", diff --git a/shell/browser/api/atom_api_web_contents.h b/shell/browser/api/atom_api_web_contents.h index 952cfe6c75e19..5604f58b0940f 100644 --- a/shell/browser/api/atom_api_web_contents.h +++ b/shell/browser/api/atom_api_web_contents.h @@ -181,6 +181,9 @@ class WebContents : public gin_helper::TrackableObject, void SetEmbedder(const WebContents* embedder); void SetDevToolsWebContents(const WebContents* devtools); v8::Local GetNativeView() const; + void IncrementCapturerCount(gin_helper::Arguments* args); + void DecrementCapturerCount(gin_helper::Arguments* args); + bool IsBeingCaptured(); #if BUILDFLAG(ENABLE_PRINTING) void Print(gin_helper::Arguments* args);