2005-01-15 03:10:19 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2005-01-15 03:10:19 +03:00
|
|
|
|
2006-03-30 09:56:38 +04:00
|
|
|
/* implementation of interface for managing user and user-agent style sheets */
|
|
|
|
|
2005-01-15 03:10:19 +03:00
|
|
|
#ifndef nsStyleSheetService_h_
|
|
|
|
#define nsStyleSheetService_h_
|
|
|
|
|
|
|
|
#include "nsIStyleSheetService.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsIStyleSheet.h"
|
2012-06-19 07:26:34 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2005-01-15 03:10:19 +03:00
|
|
|
|
|
|
|
class nsISimpleEnumerator;
|
|
|
|
class nsICategoryManager;
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
2012-10-12 08:05:38 +04:00
|
|
|
class nsIMemoryReporter;
|
|
|
|
|
2012-06-19 07:26:34 +04:00
|
|
|
class nsStyleSheetService MOZ_FINAL : public nsIStyleSheetService
|
2005-01-15 03:10:19 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsStyleSheetService() NS_HIDDEN;
|
|
|
|
~nsStyleSheetService() NS_HIDDEN;
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISTYLESHEETSERVICE
|
|
|
|
|
|
|
|
NS_HIDDEN_(nsresult) Init();
|
|
|
|
|
2005-03-23 05:34:30 +03:00
|
|
|
nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
|
|
|
|
nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
|
2012-10-16 23:45:50 +04:00
|
|
|
nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
|
2005-01-15 03:10:19 +03:00
|
|
|
|
2012-10-12 08:05:38 +04:00
|
|
|
static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf);
|
|
|
|
|
2012-10-16 23:45:56 +04:00
|
|
|
static nsStyleSheetService *GetInstance();
|
2005-01-15 03:10:19 +03:00
|
|
|
static nsStyleSheetService *gInstance;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
NS_HIDDEN_(void) RegisterFromEnumerator(nsICategoryManager *aManager,
|
|
|
|
const char *aCategory,
|
|
|
|
nsISimpleEnumerator *aEnumerator,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aSheetType);
|
2005-01-15 03:10:19 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_HIDDEN_(int32_t) FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
|
2005-03-23 05:34:30 +03:00
|
|
|
nsIURI *sheetURI);
|
|
|
|
|
2009-07-27 12:47:02 +04:00
|
|
|
// Like LoadAndRegisterSheet, but doesn't notify. If successful, the
|
2006-06-08 18:32:20 +04:00
|
|
|
// new sheet will be the last sheet in mSheets[aSheetType].
|
|
|
|
NS_HIDDEN_(nsresult) LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aSheetType);
|
2012-10-12 08:05:38 +04:00
|
|
|
|
|
|
|
size_t SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const;
|
|
|
|
|
2012-10-16 23:45:50 +04:00
|
|
|
nsCOMArray<nsIStyleSheet> mSheets[3];
|
2012-10-12 08:05:38 +04:00
|
|
|
|
|
|
|
nsIMemoryReporter* mReporter;
|
2005-01-15 03:10:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|