2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
#ifndef mozilla_dom_MediaDocument_h
|
|
|
|
#define mozilla_dom_MediaDocument_h
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-03-22 02:22:03 +00:00
|
|
|
#include "nsHTMLDocument.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2003-04-13 00:40:26 +00:00
|
|
|
#include "nsIStringBundle.h"
|
|
|
|
|
2005-02-23 16:53:28 +00:00
|
|
|
#define NSMEDIADOCUMENT_PROPERTIES_URI "chrome://global/locale/layout/MediaDocument.properties"
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class MediaDocument : public nsHTMLDocument
|
2003-03-22 02:22:03 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-05-06 13:42:00 +00:00
|
|
|
MediaDocument();
|
2011-05-26 08:06:31 +00:00
|
|
|
virtual ~MediaDocument();
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Init() override;
|
2003-04-13 00:40:26 +00:00
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
virtual nsresult StartDocumentLoad(const char* aCommand,
|
|
|
|
nsIChannel* aChannel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener** aDocListener,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aReset = true,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIContentSink* aSink = nullptr) override;
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) override;
|
2011-12-15 15:10:36 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool WillIgnoreCharsetOverride() override
|
2013-11-26 07:31:52 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
protected:
|
2012-07-27 13:35:09 +00:00
|
|
|
void BecomeInteractive();
|
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
virtual nsresult CreateSyntheticDocument();
|
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
friend class MediaDocumentStreamListener;
|
2003-03-22 02:22:03 +00:00
|
|
|
nsresult StartLayout();
|
2003-04-13 00:40:26 +00:00
|
|
|
|
2014-10-30 05:08:00 +00:00
|
|
|
void GetFileName(nsAString& aResult, nsIChannel* aChannel);
|
2009-01-16 09:07:26 +00:00
|
|
|
|
2011-11-10 23:08:07 +00:00
|
|
|
nsresult LinkStylesheet(const nsAString& aStylesheet);
|
|
|
|
|
2003-04-13 00:40:26 +00:00
|
|
|
// |aFormatNames[]| needs to have four elements in the following order:
|
|
|
|
// a format name with neither dimension nor file, a format name with
|
|
|
|
// filename but w/o dimension, a format name with dimension but w/o filename,
|
|
|
|
// a format name with both of them. For instance, it can have
|
|
|
|
// "ImageTitleWithNeitherDimensionsNorFile", "ImageTitleWithoutDimensions",
|
2013-09-04 16:52:25 +00:00
|
|
|
// "ImageTitleWithDimesions2", "ImageTitleWithDimensions2AndFile".
|
2003-04-13 00:40:26 +00:00
|
|
|
//
|
|
|
|
// Also see MediaDocument.properties if you want to define format names
|
2011-05-26 08:06:31 +00:00
|
|
|
// for a new subclass. aWidth and aHeight are pixels for |ImageDocument|,
|
2003-04-13 00:40:26 +00:00
|
|
|
// but could be in other units for other 'media', in which case you have to
|
|
|
|
// define format names accordingly.
|
2003-04-21 22:45:28 +00:00
|
|
|
void UpdateTitleAndCharset(const nsACString& aTypeStr,
|
2014-10-30 05:08:00 +00:00
|
|
|
nsIChannel* aChannel,
|
2003-04-13 00:40:26 +00:00
|
|
|
const char* const* aFormatNames = sFormatNames,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aWidth = 0,
|
|
|
|
int32_t aHeight = 0,
|
2004-01-29 22:04:45 +00:00
|
|
|
const nsAString& aStatus = EmptyString());
|
2003-04-13 00:40:26 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIStringBundle> mStringBundle;
|
2003-04-21 22:45:28 +00:00
|
|
|
static const char* const sFormatNames[4];
|
2011-12-15 15:10:36 +00:00
|
|
|
|
2003-04-13 00:40:26 +00:00
|
|
|
private:
|
|
|
|
enum {eWithNoInfo, eWithFile, eWithDim, eWithDimAndFile};
|
2011-12-15 15:10:36 +00:00
|
|
|
bool mDocumentElementInserted;
|
2003-03-22 02:22:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
class MediaDocumentStreamListener: public nsIStreamListener
|
2003-03-22 02:22:03 +00:00
|
|
|
{
|
2014-06-25 02:09:15 +00:00
|
|
|
protected:
|
|
|
|
virtual ~MediaDocumentStreamListener();
|
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit MediaDocumentStreamListener(MediaDocument* aDocument);
|
2003-03-22 02:22:03 +00:00
|
|
|
void SetStreamListener(nsIStreamListener *aListener);
|
|
|
|
|
2014-02-17 02:26:56 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
|
|
|
|
|
|
NS_DECL_NSISTREAMLISTENER
|
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
nsRefPtr<MediaDocument> mDocument;
|
2003-03-22 02:22:03 +00:00
|
|
|
nsCOMPtr<nsIStreamListener> mNextStream;
|
|
|
|
};
|
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2011-05-26 08:06:31 +00:00
|
|
|
#endif /* mozilla_dom_MediaDocument_h */
|