tor-browser

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

CamerasTypes.h (2013B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set sw=2 ts=8 et ft=cpp : */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_CamerasTypes_h
      8 #define mozilla_CamerasTypes_h
      9 
     10 #include "PerformanceRecorder.h"
     11 #include "ipc/EnumSerializer.h"
     12 
     13 namespace mozilla::camera {
     14 
     15 enum CaptureEngine : int {
     16  InvalidEngine = 0,
     17  ScreenEngine,
     18  BrowserEngine,
     19  WinEngine,
     20  CameraEngine,
     21  MaxEngine
     22 };
     23 
     24 enum class CamerasAccessStatus {
     25  // We have full access to cameras, either because it was granted, or because
     26  // requesting it from the user was not necessary.
     27  Granted = 1,
     28  // A permission request to the platform is required before we know the
     29  // camera access status. Enumeration will result in a single placeholder
     30  // device, should any cameras be present on the system. The placeholder
     31  // device cannot be captured.
     32  RequestRequired,
     33  // A permission request was made and was rejected by the platform.
     34  Rejected,
     35  // Generic error while doing the request, for instance with pipewire most
     36  // likely the xdg-desktop-portal request failed.
     37  Error,
     38 };
     39 
     40 TrackingId::Source CaptureEngineToTrackingSourceStr(
     41    const CaptureEngine& aEngine);
     42 
     43 }  // namespace mozilla::camera
     44 
     45 namespace IPC {
     46 template <>
     47 struct ParamTraits<mozilla::camera::CaptureEngine>
     48    : public ContiguousEnumSerializer<
     49          mozilla::camera::CaptureEngine,
     50          mozilla::camera::CaptureEngine::InvalidEngine,
     51          mozilla::camera::CaptureEngine::MaxEngine> {};
     52 
     53 template <>
     54 struct ParamTraits<mozilla::camera::CamerasAccessStatus>
     55    : public ContiguousEnumSerializerInclusive<
     56          mozilla::camera::CamerasAccessStatus,
     57          mozilla::camera::CamerasAccessStatus::Granted,
     58          mozilla::camera::CamerasAccessStatus::Error> {};
     59 }  // namespace IPC
     60 
     61 #endif  // mozilla_CamerasTypes_h