tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

desktop_device_info.h (2139B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
      6 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
      7 
      8 #include "modules/desktop_capture/desktop_capture_types.h"
      9 #include "modules/video_capture/video_capture.h"
     10 #include "nsString.h"
     11 
     12 namespace webrtc {
     13 
     14 class DesktopCaptureOptions;
     15 
     16 class DesktopSource {
     17 public:
     18  void setScreenId(ScreenId aId);
     19  void setName(nsCString&& aName);
     20  void setUniqueId(nsCString&& aId);
     21  void setPid(pid_t aPid);
     22 
     23  ScreenId getScreenId() const;
     24  const nsCString& getName() const;
     25  const nsCString& getUniqueId() const;
     26  pid_t getPid() const;
     27 
     28 protected:
     29  ScreenId mScreenId = kInvalidScreenId;
     30  nsCString mName;
     31  nsCString mUniqueId;
     32  pid_t mPid = 0;
     33 };
     34 
     35 class TabSource {
     36 public:
     37  void setBrowserId(uint64_t aId);
     38  void setName(nsCString&& aName);
     39  void setUniqueId(nsCString&& aId);
     40 
     41  uint64_t getBrowserId() const;
     42  const nsCString& getName() const;
     43  const nsCString& getUniqueId() const;
     44 
     45 protected:
     46  uint64_t mBrowserId = 0;
     47  nsCString mName;
     48  nsCString mUniqueId;
     49 };
     50 
     51 template <typename Source>
     52 class CaptureInfo {
     53 public:
     54  virtual ~CaptureInfo() = default;
     55 
     56  virtual void Refresh() = 0;
     57  virtual size_t getSourceCount() const = 0;
     58  virtual const Source* getSource(size_t aIndex) const = 0;
     59 };
     60 
     61 using DesktopCaptureInfo = CaptureInfo<DesktopSource>;
     62 std::unique_ptr<DesktopCaptureInfo> CreateScreenCaptureInfo(
     63    const DesktopCaptureOptions& aOptions);
     64 std::unique_ptr<DesktopCaptureInfo> CreateWindowCaptureInfo(
     65    const DesktopCaptureOptions& aOptions);
     66 using TabCaptureInfo = CaptureInfo<TabSource>;
     67 std::unique_ptr<TabCaptureInfo> CreateTabCaptureInfo();
     68 
     69 std::shared_ptr<VideoCaptureModule::DeviceInfo> CreateDesktopDeviceInfo(
     70    int32_t aId, std::unique_ptr<DesktopCaptureInfo>&& aInfo);
     71 std::shared_ptr<VideoCaptureModule::DeviceInfo> CreateTabDeviceInfo(
     72    int32_t aId, std::unique_ptr<TabCaptureInfo>&& aInfo);
     73 
     74 };  // namespace webrtc
     75 
     76 #endif