dom/mobilemessage/src/MmsMessage.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_dom_mobilemessage_MmsMessage_h
michael@0 7 #define mozilla_dom_mobilemessage_MmsMessage_h
michael@0 8
michael@0 9 #include "nsIDOMMozMmsMessage.h"
michael@0 10 #include "nsString.h"
michael@0 11 #include "mozilla/dom/mobilemessage/Types.h"
michael@0 12 #include "mozilla/dom/MozMmsMessageBinding.h"
michael@0 13 #include "mozilla/Attributes.h"
michael@0 14
michael@0 15 namespace mozilla {
michael@0 16 namespace dom {
michael@0 17
michael@0 18 namespace mobilemessage {
michael@0 19 class MmsMessageData;
michael@0 20 } // namespace mobilemessage
michael@0 21
michael@0 22 class ContentParent;
michael@0 23
michael@0 24 class MmsMessage MOZ_FINAL : public nsIDOMMozMmsMessage
michael@0 25 {
michael@0 26 public:
michael@0 27 NS_DECL_ISUPPORTS
michael@0 28 NS_DECL_NSIDOMMOZMMSMESSAGE
michael@0 29
michael@0 30 // If this is changed, change the WebIDL dictionary as well.
michael@0 31 struct Attachment MOZ_FINAL
michael@0 32 {
michael@0 33 nsCOMPtr<nsIDOMBlob> content;
michael@0 34 nsString id;
michael@0 35 nsString location;
michael@0 36
michael@0 37 explicit Attachment(const MmsAttachment& aAttachment) :
michael@0 38 content(aAttachment.mContent),
michael@0 39 id(aAttachment.mId),
michael@0 40 location(aAttachment.mLocation)
michael@0 41 {}
michael@0 42 };
michael@0 43
michael@0 44 MmsMessage(int32_t aId,
michael@0 45 uint64_t aThreadId,
michael@0 46 const nsAString& aIccId,
michael@0 47 mobilemessage::DeliveryState aDelivery,
michael@0 48 const nsTArray<MmsDeliveryInfo>& aDeliveryInfo,
michael@0 49 const nsAString& aSender,
michael@0 50 const nsTArray<nsString>& aReceivers,
michael@0 51 uint64_t aTimestamp,
michael@0 52 uint64_t aSentTimestamp,
michael@0 53 bool aRead,
michael@0 54 const nsAString& aSubject,
michael@0 55 const nsAString& aSmil,
michael@0 56 const nsTArray<Attachment>& aAttachments,
michael@0 57 uint64_t aExpiryDate,
michael@0 58 bool aReadReportRequested);
michael@0 59
michael@0 60 MmsMessage(const mobilemessage::MmsMessageData& aData);
michael@0 61
michael@0 62 static nsresult Create(int32_t aId,
michael@0 63 uint64_t aThreadId,
michael@0 64 const nsAString& aIccId,
michael@0 65 const nsAString& aDelivery,
michael@0 66 const JS::Value& aDeliveryInfo,
michael@0 67 const nsAString& aSender,
michael@0 68 const JS::Value& aReceivers,
michael@0 69 uint64_t aTimestamp,
michael@0 70 uint64_t aSentTimestamp,
michael@0 71 bool aRead,
michael@0 72 const nsAString& aSubject,
michael@0 73 const nsAString& aSmil,
michael@0 74 const JS::Value& aAttachments,
michael@0 75 uint64_t aExpiryDate,
michael@0 76 bool aReadReportRequested,
michael@0 77 JSContext* aCx,
michael@0 78 nsIDOMMozMmsMessage** aMessage);
michael@0 79
michael@0 80 bool GetData(ContentParent* aParent,
michael@0 81 mobilemessage::MmsMessageData& aData);
michael@0 82
michael@0 83 private:
michael@0 84
michael@0 85 int32_t mId;
michael@0 86 uint64_t mThreadId;
michael@0 87 nsString mIccId;
michael@0 88 mobilemessage::DeliveryState mDelivery;
michael@0 89 nsTArray<MmsDeliveryInfo> mDeliveryInfo;
michael@0 90 nsString mSender;
michael@0 91 nsTArray<nsString> mReceivers;
michael@0 92 uint64_t mTimestamp;
michael@0 93 uint64_t mSentTimestamp;
michael@0 94 bool mRead;
michael@0 95 nsString mSubject;
michael@0 96 nsString mSmil;
michael@0 97 nsTArray<Attachment> mAttachments;
michael@0 98 uint64_t mExpiryDate;
michael@0 99 bool mReadReportRequested;
michael@0 100 };
michael@0 101
michael@0 102 } // namespace dom
michael@0 103 } // namespace mozilla
michael@0 104
michael@0 105 #endif // mozilla_dom_mobilemessage_MmsMessage_h

mercurial