1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef nsOfflineCacheUpdateParent_h
7 #define nsOfflineCacheUpdateParent_h
8 
9 #include "mozilla/docshell/POfflineCacheUpdateParent.h"
10 #include "mozilla/BasePrincipal.h"
11 #include "nsIOfflineCacheUpdate.h"
12 
13 #include "nsCOMPtr.h"
14 #include "nsString.h"
15 #include "nsILoadContext.h"
16 
17 class nsIPrincipal;
18 
19 namespace mozilla {
20 
21 namespace ipc {
22 class URIParams;
23 }  // namespace ipc
24 
25 namespace docshell {
26 
27 class OfflineCacheUpdateParent : public POfflineCacheUpdateParent,
28                                  public nsIOfflineCacheUpdateObserver,
29                                  public nsILoadContext {
30   typedef mozilla::ipc::URIParams URIParams;
31   typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
32 
33  public:
34   NS_DECL_ISUPPORTS
35   NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER
36   NS_DECL_NSILOADCONTEXT
37 
38   nsresult Schedule(const URIParams& manifestURI, const URIParams& documentURI,
39                     const PrincipalInfo& loadingPrincipalInfo,
40                     const bool& stickDocument);
41 
StopSendingMessagesToChild()42   void StopSendingMessagesToChild() { mIPCClosed = true; }
43 
44   explicit OfflineCacheUpdateParent();
45 
46   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
47 
48  private:
49   ~OfflineCacheUpdateParent();
50 
51   bool mIPCClosed;
52 
53   nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
54 };
55 
56 }  // namespace docshell
57 }  // namespace mozilla
58 
59 #endif
60