Bumping manifests a=b2g-bump
[gecko.git] / layout / base / nsStyleSheetService.h
blob31346fdea4860416cddf58eec0492d033c2928da
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* implementation of interface for managing user and user-agent style sheets */
9 #ifndef nsStyleSheetService_h_
10 #define nsStyleSheetService_h_
12 #include "nsCOMArray.h"
13 #include "nsCOMPtr.h"
14 #include "nsIMemoryReporter.h"
15 #include "nsIStyleSheetService.h"
16 #include "mozilla/Attributes.h"
17 #include "mozilla/MemoryReporting.h"
19 class nsICategoryManager;
20 class nsIMemoryReporter;
21 class nsISimpleEnumerator;
22 class nsIStyleSheet;
24 #define NS_STYLESHEETSERVICE_CID \
25 {0xfcca6f83, 0x9f7d, 0x44e4, {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}}
27 #define NS_STYLESHEETSERVICE_CONTRACTID \
28 "@mozilla.org/content/style-sheet-service;1"
30 class nsStyleSheetService MOZ_FINAL
31 : public nsIStyleSheetService
32 , public nsIMemoryReporter
34 public:
35 nsStyleSheetService();
37 NS_DECL_ISUPPORTS
38 NS_DECL_NSISTYLESHEETSERVICE
39 NS_DECL_NSIMEMORYREPORTER
41 nsresult Init();
43 nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
44 nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
45 nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
47 size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
49 static nsStyleSheetService *GetInstance();
50 static nsStyleSheetService *gInstance;
52 private:
53 ~nsStyleSheetService();
55 void RegisterFromEnumerator(nsICategoryManager *aManager,
56 const char *aCategory,
57 nsISimpleEnumerator *aEnumerator,
58 uint32_t aSheetType);
60 int32_t FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
61 nsIURI *sheetURI);
63 // Like LoadAndRegisterSheet, but doesn't notify. If successful, the
64 // new sheet will be the last sheet in mSheets[aSheetType].
65 nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
66 uint32_t aSheetType);
68 nsCOMArray<nsIStyleSheet> mSheets[3];
71 #endif