2013-01-18 00:45:12 +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/. */
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2006-03-30 05:56:38 +00:00
|
|
|
/* implementation of interface for managing user and user-agent style sheets */
|
|
|
|
|
2005-01-15 00:10:19 +00:00
|
|
|
#ifndef nsStyleSheetService_h_
|
|
|
|
#define nsStyleSheetService_h_
|
|
|
|
|
|
|
|
#include "nsCOMArray.h"
|
2013-01-18 00:45:12 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2013-11-07 05:35:30 +00:00
|
|
|
#include "nsIMemoryReporter.h"
|
2013-01-18 00:45:12 +00:00
|
|
|
#include "nsIStyleSheetService.h"
|
2012-06-19 03:26:34 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2005-01-15 00:10:19 +00:00
|
|
|
|
|
|
|
class nsICategoryManager;
|
2013-01-18 00:45:12 +00:00
|
|
|
class nsIMemoryReporter;
|
|
|
|
class nsISimpleEnumerator;
|
2013-08-19 22:55:18 +00:00
|
|
|
class nsIStyleSheet;
|
2005-01-15 00:10:19 +00:00
|
|
|
|
|
|
|
#define NS_STYLESHEETSERVICE_CID \
|
|
|
|
{0xfcca6f83, 0x9f7d, 0x44e4, {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}}
|
|
|
|
|
|
|
|
#define NS_STYLESHEETSERVICE_CONTRACTID \
|
|
|
|
"@mozilla.org/content/style-sheet-service;1"
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsStyleSheetService final
|
2013-12-08 06:09:10 +00:00
|
|
|
: public nsIStyleSheetService
|
|
|
|
, public nsIMemoryReporter
|
2005-01-15 00:10:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-06-02 12:08:24 +00:00
|
|
|
nsStyleSheetService();
|
2005-01-15 00:10:19 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISTYLESHEETSERVICE
|
2013-12-08 06:09:10 +00:00
|
|
|
NS_DECL_NSIMEMORYREPORTER
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2014-06-02 12:08:21 +00:00
|
|
|
nsresult Init();
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2005-03-23 02:34:30 +00:00
|
|
|
nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
|
|
|
|
nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
|
2012-10-16 19:45:50 +00:00
|
|
|
nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2013-01-18 00:45:12 +00:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2012-10-12 04:05:38 +00:00
|
|
|
|
2012-10-16 19:45:56 +00:00
|
|
|
static nsStyleSheetService *GetInstance();
|
2005-01-15 00:10:19 +00:00
|
|
|
static nsStyleSheetService *gInstance;
|
|
|
|
|
|
|
|
private:
|
2014-06-23 22:40:01 +00:00
|
|
|
~nsStyleSheetService();
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2014-06-02 12:08:21 +00:00
|
|
|
void RegisterFromEnumerator(nsICategoryManager *aManager,
|
2005-01-15 00:10:19 +00:00
|
|
|
const char *aCategory,
|
|
|
|
nsISimpleEnumerator *aEnumerator,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aSheetType);
|
2005-01-15 00:10:19 +00:00
|
|
|
|
2014-06-02 12:08:21 +00:00
|
|
|
int32_t FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
|
2005-03-23 02:34:30 +00:00
|
|
|
nsIURI *sheetURI);
|
|
|
|
|
2009-07-27 08:47:02 +00:00
|
|
|
// Like LoadAndRegisterSheet, but doesn't notify. If successful, the
|
2006-06-08 14:32:20 +00:00
|
|
|
// new sheet will be the last sheet in mSheets[aSheetType].
|
2014-06-02 12:08:21 +00:00
|
|
|
nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
2014-07-09 09:43:33 +00:00
|
|
|
uint32_t aSheetType);
|
2012-10-12 04:05:38 +00:00
|
|
|
|
2012-10-16 19:45:50 +00:00
|
|
|
nsCOMArray<nsIStyleSheet> mSheets[3];
|
2005-01-15 00:10:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|