uriloader/prefetch/OfflineCacheUpdateParent.h
author Jan de Mooij <jdemooij@mozilla.com>
Fri, 18 Oct 2019 14:14:11 +0000
changeset 498303 a6e168c78b26cdf69e7a151948c277b4c9d8fea9
parent 497728 ae8dbea0d35a5900b4194072953d3856bec1ecc9
permissions -rw-r--r--
Bug 1586991 part 26 - Don't assume null-terminated strings in Middleman_HadRepaint. r=bhackett Depends on D49749 Differential Revision: https://phabricator.services.mozilla.com/D49750

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef nsOfflineCacheUpdateParent_h
#define nsOfflineCacheUpdateParent_h

#include "mozilla/docshell/POfflineCacheUpdateParent.h"
#include "mozilla/BasePrincipal.h"
#include "nsIOfflineCacheUpdate.h"

#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsILoadContext.h"

class nsIPrincipal;

namespace mozilla {

namespace ipc {
class URIParams;
}  // namespace ipc

namespace net {
class CookieSettingsArgs;
}

namespace docshell {

class OfflineCacheUpdateParent : public POfflineCacheUpdateParent,
                                 public nsIOfflineCacheUpdateObserver,
                                 public nsILoadContext {
  typedef mozilla::ipc::URIParams URIParams;
  typedef mozilla::ipc::PrincipalInfo PrincipalInfo;

 public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER
  NS_DECL_NSILOADCONTEXT

  nsresult Schedule(const URIParams& manifestURI, const URIParams& documentURI,
                    const PrincipalInfo& loadingPrincipalInfo,
                    const bool& stickDocument,
                    const net::CookieSettingsArgs& aCookieSettingsArgs);

  void StopSendingMessagesToChild() { mIPCClosed = true; }

  explicit OfflineCacheUpdateParent();

  virtual void ActorDestroy(ActorDestroyReason aWhy) override;

 private:
  ~OfflineCacheUpdateParent();

  bool mIPCClosed;

  nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
};

}  // namespace docshell
}  // namespace mozilla

#endif