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