fix_expose_decrementcapturercount_in_web_contents_impl.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Fri, 9 Apr 2021 19:30:01 +0200
  4. Subject: fix: expose DecrementCapturerCount in web_contents_impl
  5. This was made private in https://chromium-review.googlesource.com/c/chromium/src/+/2807829 but
  6. we invoke it in order to expose contents.decrementCapturerCount([stayHidden, stayAwake])
  7. to users. We should try to upstream this.
  8. diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
  9. index e379c4cf966a96ace1bd692cda31bae032f13acf..b800ca0aa616ae347f93156ccef79032f3ea1608 100644
  10. --- a/content/browser/web_contents/web_contents_impl.h
  11. +++ b/content/browser/web_contents/web_contents_impl.h
  12. @@ -1772,10 +1772,12 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
  13. // outermost frame trees in this WebContents.
  14. std::vector<RenderFrameHostImpl*> GetOutermostMainFrames();
  15. + public:
  16. // Called when the base::ScopedClosureRunner returned by
  17. // IncrementCapturerCount() is destructed.
  18. - void DecrementCapturerCount(bool stay_hidden, bool stay_awake);
  19. + void DecrementCapturerCount(bool stay_hidden, bool stay_awake) override;
  20. + private:
  21. // Calculates the PageVisibilityState for |visibility|, taking the capturing
  22. // state into account.
  23. PageVisibilityState CalculatePageVisibilityState(Visibility visibility) const;
  24. diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
  25. index 67fb7c487e68af563859e76d4b0f46e44756128a..49189dadc4dba04f789e8b562a11205055231155 100644
  26. --- a/content/public/browser/web_contents.h
  27. +++ b/content/public/browser/web_contents.h
  28. @@ -631,6 +631,8 @@ class WebContents : public PageNavigator,
  29. bool stay_hidden,
  30. bool stay_awake) WARN_UNUSED_RESULT = 0;
  31. + virtual void DecrementCapturerCount(bool stay_hidden, bool stay_awake) = 0;
  32. +
  33. // Getter for the capture handle, which allows a captured application to
  34. // opt-in to exposing information to its capturer(s).
  35. virtual const blink::mojom::CaptureHandleConfig& GetCaptureHandleConfig() = 0;