tor-browser

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

MessageManagerCallback.h (1872B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      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
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef dom_base_MessageManagerCallback_h__
      8 #define dom_base_MessageManagerCallback_h__
      9 
     10 #include "mozilla/UniquePtr.h"
     11 #include "nsError.h"
     12 #include "nsStringFwd.h"
     13 #include "nsTArrayForwardDeclare.h"
     14 
     15 namespace mozilla {
     16 
     17 class ErrorResult;
     18 
     19 namespace dom {
     20 
     21 class ClonedMessageData;
     22 class ContentChild;
     23 class ContentParent;
     24 class ProcessMessageManager;
     25 
     26 namespace ipc {
     27 
     28 class StructuredCloneData;
     29 
     30 class MessageManagerCallback {
     31 public:
     32  virtual ~MessageManagerCallback() = default;
     33 
     34  virtual bool DoLoadMessageManagerScript(const nsAString& aURL,
     35                                          bool aRunInGlobalScope) {
     36    return true;
     37  }
     38 
     39  virtual bool DoSendBlockingMessage(
     40      const nsAString& aMessage, StructuredCloneData& aData,
     41      nsTArray<UniquePtr<StructuredCloneData>>* aRetVal) {
     42    return true;
     43  }
     44 
     45  virtual nsresult DoSendAsyncMessage(const nsAString& aMessage,
     46                                      StructuredCloneData& aData) {
     47    return NS_OK;
     48  }
     49 
     50  virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager()
     51      const {
     52    return nullptr;
     53  }
     54 
     55  virtual void DoGetRemoteType(nsACString& aRemoteType,
     56                               ErrorResult& aError) const;
     57 
     58 protected:
     59  bool BuildClonedMessageData(StructuredCloneData& aData,
     60                              ClonedMessageData& aClonedData);
     61 };
     62 
     63 void UnpackClonedMessageData(const ClonedMessageData& aClonedData,
     64                             StructuredCloneData& aData);
     65 
     66 }  // namespace ipc
     67 }  // namespace dom
     68 }  // namespace mozilla
     69 
     70 #endif