1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  *
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 WebBrowserPersistRemoteDocument_h__
8 #define WebBrowserPersistRemoteDocument_h__
9 
10 #include "mozilla/Maybe.h"
11 #include "mozilla/PWebBrowserPersistDocumentParent.h"
12 #include "nsCOMPtr.h"
13 #include "nsIWebBrowserPersistDocument.h"
14 #include "nsIInputStream.h"
15 
16 class nsIPrincipal;
17 
18 // This class is the XPCOM half of the glue between the
19 // nsIWebBrowserPersistDocument interface and a remote document; it is
20 // created by WebBrowserPersistDocumentParent when (and if) it
21 // receives the information needed to populate the interface's
22 // properties.
23 //
24 // This object has a normal refcounted lifetime.  The corresponding
25 // IPC actor holds a weak reference to this class; when the last
26 // strong reference is released, it sends an IPC delete message and
27 // thereby removes that reference.
28 
29 namespace mozilla {
30 
31 class WebBrowserPersistDocumentParent;
32 
33 class WebBrowserPersistRemoteDocument final
34     : public nsIWebBrowserPersistDocument {
35  public:
36   NS_DECL_ISUPPORTS
37   NS_DECL_NSIWEBBROWSERPERSISTDOCUMENT
38 
39  private:
40   using Attrs = WebBrowserPersistDocumentAttrs;
41   WebBrowserPersistDocumentParent* mActor;
42   Attrs mAttrs;
43   nsCOMPtr<nsISHEntry> mSHEntry;
44   nsCOMPtr<nsICookieJarSettings> mCookieJarSettings;
45   nsCOMPtr<nsIInputStream> mPostData;
46   nsCOMPtr<nsIPrincipal> mPrincipal;
47 
48   friend class WebBrowserPersistDocumentParent;
49   WebBrowserPersistRemoteDocument(WebBrowserPersistDocumentParent* aActor,
50                                   const Attrs& aAttrs,
51                                   nsIInputStream* aPostData);
52   ~WebBrowserPersistRemoteDocument();
53 
54   void ActorDestroy(void);
55 };
56 
57 }  // namespace mozilla
58 
59 #endif  // WebBrowserPersistRemoteDocument_h__
60