content/html/document/src/MediaDocument.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_dom_MediaDocument_h
michael@0 7 #define mozilla_dom_MediaDocument_h
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nsHTMLDocument.h"
michael@0 11 #include "nsGenericHTMLElement.h"
michael@0 12 #include "nsAutoPtr.h"
michael@0 13 #include "nsIStringBundle.h"
michael@0 14
michael@0 15 #define NSMEDIADOCUMENT_PROPERTIES_URI "chrome://global/locale/layout/MediaDocument.properties"
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace dom {
michael@0 19
michael@0 20 class MediaDocument : public nsHTMLDocument
michael@0 21 {
michael@0 22 public:
michael@0 23 MediaDocument();
michael@0 24 virtual ~MediaDocument();
michael@0 25
michael@0 26 virtual nsresult Init() MOZ_OVERRIDE;
michael@0 27
michael@0 28 virtual nsresult StartDocumentLoad(const char* aCommand,
michael@0 29 nsIChannel* aChannel,
michael@0 30 nsILoadGroup* aLoadGroup,
michael@0 31 nsISupports* aContainer,
michael@0 32 nsIStreamListener** aDocListener,
michael@0 33 bool aReset = true,
michael@0 34 nsIContentSink* aSink = nullptr) MOZ_OVERRIDE;
michael@0 35
michael@0 36 virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) MOZ_OVERRIDE;
michael@0 37
michael@0 38 virtual bool WillIgnoreCharsetOverride()
michael@0 39 {
michael@0 40 return true;
michael@0 41 }
michael@0 42
michael@0 43 protected:
michael@0 44 void BecomeInteractive();
michael@0 45
michael@0 46 virtual nsresult CreateSyntheticDocument();
michael@0 47
michael@0 48 friend class MediaDocumentStreamListener;
michael@0 49 nsresult StartLayout();
michael@0 50
michael@0 51 void GetFileName(nsAString& aResult);
michael@0 52
michael@0 53 nsresult LinkStylesheet(const nsAString& aStylesheet);
michael@0 54
michael@0 55 // |aFormatNames[]| needs to have four elements in the following order:
michael@0 56 // a format name with neither dimension nor file, a format name with
michael@0 57 // filename but w/o dimension, a format name with dimension but w/o filename,
michael@0 58 // a format name with both of them. For instance, it can have
michael@0 59 // "ImageTitleWithNeitherDimensionsNorFile", "ImageTitleWithoutDimensions",
michael@0 60 // "ImageTitleWithDimesions2", "ImageTitleWithDimensions2AndFile".
michael@0 61 //
michael@0 62 // Also see MediaDocument.properties if you want to define format names
michael@0 63 // for a new subclass. aWidth and aHeight are pixels for |ImageDocument|,
michael@0 64 // but could be in other units for other 'media', in which case you have to
michael@0 65 // define format names accordingly.
michael@0 66 void UpdateTitleAndCharset(const nsACString& aTypeStr,
michael@0 67 const char* const* aFormatNames = sFormatNames,
michael@0 68 int32_t aWidth = 0,
michael@0 69 int32_t aHeight = 0,
michael@0 70 const nsAString& aStatus = EmptyString());
michael@0 71
michael@0 72 nsCOMPtr<nsIStringBundle> mStringBundle;
michael@0 73 static const char* const sFormatNames[4];
michael@0 74
michael@0 75 private:
michael@0 76 enum {eWithNoInfo, eWithFile, eWithDim, eWithDimAndFile};
michael@0 77 bool mDocumentElementInserted;
michael@0 78 };
michael@0 79
michael@0 80
michael@0 81 class MediaDocumentStreamListener: public nsIStreamListener
michael@0 82 {
michael@0 83 public:
michael@0 84 MediaDocumentStreamListener(MediaDocument *aDocument);
michael@0 85 virtual ~MediaDocumentStreamListener();
michael@0 86 void SetStreamListener(nsIStreamListener *aListener);
michael@0 87
michael@0 88 NS_DECL_ISUPPORTS
michael@0 89
michael@0 90 NS_DECL_NSIREQUESTOBSERVER
michael@0 91
michael@0 92 NS_DECL_NSISTREAMLISTENER
michael@0 93
michael@0 94 nsRefPtr<MediaDocument> mDocument;
michael@0 95 nsCOMPtr<nsIStreamListener> mNextStream;
michael@0 96 };
michael@0 97
michael@0 98 } // namespace dom
michael@0 99 } // namespace mozilla
michael@0 100
michael@0 101 #endif /* mozilla_dom_MediaDocument_h */

mercurial