tor-browser

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

MediaChild.h (1626B)


      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_MediaChild_h
      8 #define mozilla_MediaChild_h
      9 
     10 #include "MediaUtils.h"
     11 #include "mozilla/media/PMediaChild.h"
     12 #include "mozilla/media/PMediaParent.h"
     13 
     14 namespace mozilla {
     15 
     16 namespace ipc {
     17 class PrincipalInfo;
     18 }
     19 
     20 namespace media {
     21 
     22 typedef MozPromise<nsCString, nsresult, false> PrincipalKeyPromise;
     23 
     24 // media::Child implements proxying to the chrome process for some media-related
     25 // functions, for the moment just:
     26 //
     27 // GetPrincipalKey() - get a cookie-like persisted unique key for a given
     28 // principalInfo.
     29 //
     30 // SanitizeOriginKeys() - reset persisted unique keys.
     31 
     32 // GetPrincipalKey and SanitizeOriginKeys are asynchronous APIs that return
     33 // pledges (promise-like objects) with the future value. Use pledge.Then(func)
     34 // to access.
     35 
     36 RefPtr<PrincipalKeyPromise> GetPrincipalKey(
     37    const mozilla::ipc::PrincipalInfo& aPrincipalInfo, bool aPersist);
     38 
     39 void SanitizeOriginKeys(const uint64_t& aSinceWhen, bool aOnlyPrivateBrowsing);
     40 
     41 class Child : public PMediaChild {
     42 public:
     43  static Child* Get();
     44 
     45  Child();
     46 
     47  void ActorDestroy(ActorDestroyReason aWhy) override;
     48  virtual ~Child();
     49 
     50 private:
     51  bool mActorDestroyed;
     52 };
     53 
     54 PMediaChild* AllocPMediaChild();
     55 bool DeallocPMediaChild(PMediaChild* aActor);
     56 
     57 }  // namespace media
     58 }  // namespace mozilla
     59 
     60 #endif  // mozilla_MediaChild_h