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