Commit ba4a68ee authored by Yuri Wiitala's avatar Yuri Wiitala Committed by Chromium LUCI CQ

Refresh WebContents API docs for IncrementCapturerCount(), et al.

This clarifies, and better documents the side effects of using the
WebContents capture notification APIs. This is a follow-up task from a
recent post-mortem discussion.

Bug: 1144868
Change-Id: I1a55025df42e85578b7d6200e1b38a151157ab6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611912
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Auto-Submit: Yuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841244}
parent ed18bdac
......@@ -516,22 +516,48 @@ class WebContents : public PageNavigator,
// Internal state ------------------------------------------------------------
// Indicates whether the WebContents is being captured (e.g., for screenshots
// or mirroring). Increment calls must be balanced with an equivalent number
// of decrement calls. |capture_size| specifies the capturer's video
// resolution, but can be empty to mean "unspecified." The first screen
// capturer that provides a non-empty |capture_size| will override the value
// returned by GetPreferredSize() until all captures have ended. |stay_hidden|
// determines whether to treat the underlying page as user-visible or not.
// Indicates whether the WebContents is being captured (e.g., for screenshots,
// or mirroring video and/or audio). Each IncrementCapturerCount() call must
// be balanced with a corresponding DecrementCapturerCount() call.
//
// Both internal-to-content and embedders must increment the capturer count
// while capturing to ensure "hidden rendering" optimizations are disabled.
// For example, renderers will be configured to produce compositor frames
// regardless of their "backgrounded" or on-screen occlusion state.
//
// Embedders can detect whether a WebContents is being captured (see
// IsBeingCaptured() below) and use this, for example, to provide an
// alternative user interface. So, developers should be careful to understand
// the side-effects from using or changing these APIs, both upstream and
// downstream of this API layer.
//
// |capture_size| is only used in the case of mirroring (i.e., screen capture
// video); otherwise, an empty gfx::Size should be provided. This specifies
// the capturer's target video resolution, but can be empty to mean
// "unspecified." This becomes a temporary override to GetPreferredSize(),
// allowing embedders to size the WebContents on-screen views for optimal
// capture quality.
//
// |stay_hidden| affects the page visibility state of the renderers (i.e., a
// web page can be made aware of whether it is actually user-visible). If
// true, the show/hide state of the WebContents will be passed to the
// renderers, like normal. If false, the renderers will always be told they
// are user-visible while being captured.
virtual void IncrementCapturerCount(const gfx::Size& capture_size,
bool stay_hidden) = 0;
virtual void DecrementCapturerCount(bool stay_hidden) = 0;
// Returns true if audio/screenshot/video is being captured by the embedder,
// as indicated by calls to IncrementCapturerCount().
virtual bool IsBeingCaptured() = 0;
// Returns true if there is any active capturer that called
// IncrementCaptureCount() with |stay_hidden|==false.
// Returns true if audio/screenshot/video is being captured by the embedder
// and renderers are being told they are always user-visible, as indicated by
// calls to IncrementCapturerCount().
virtual bool IsBeingVisiblyCaptured() = 0;
// Indicates/Sets whether all audio output from this WebContents is muted.
// This does not affect audio capture, just local/system output.
virtual bool IsAudioMuted() = 0;
virtual void SetAudioMuted(bool mute) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment