screen_enumerator.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_CAPTURE_CONTENT_SCREEN_ENUMERATOR_H_
  5. #define MEDIA_CAPTURE_CONTENT_SCREEN_ENUMERATOR_H_
  6. #include "base/callback.h"
  7. namespace blink::mojom {
  8. class StreamDevicesSet;
  9. enum class MediaStreamType;
  10. enum class MediaStreamRequestResult;
  11. } // namespace blink::mojom
  12. namespace media {
  13. // This class provides an interface for enumeration of all attached screens.
  14. // The screens are returned in a callback all at once (instead of one
  15. // callback per screen as soon as it is discovered).
  16. class ScreenEnumerator {
  17. public:
  18. virtual ~ScreenEnumerator() = default;
  19. // This function triggers enumeration of all available screens and calls
  20. // the |screens_callback| with all screen as MediaStreamDevices.
  21. // The returned screen ids are sorted in the same order as in the
  22. // |getScreenDetails| API.
  23. // https://w3c.github.io/window-placement/#api-window-getScreenDetails-method
  24. // TODO(crbug.com/1339802): Introduce matching IDs between screens returned
  25. // by this function and by the window placement API to make sure the screen
  26. // matching is not getting out of sync.
  27. virtual void EnumerateScreens(
  28. blink::mojom::MediaStreamType stream_type,
  29. base::OnceCallback<
  30. void(const blink::mojom::StreamDevicesSet& stream_devices_set,
  31. blink::mojom::MediaStreamRequestResult result)> screens_callback)
  32. const = 0;
  33. };
  34. } // namespace media
  35. #endif // MEDIA_CAPTURE_CONTENT_SCREEN_ENUMERATOR_H_