Release versions 1.2.11 and 1.2.11-1
[videolink.git] / style_sheets.cpp
1 // Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
2 // See the file "COPYING" for licence details.
3
4 #include "style_sheets.hpp"
5
6 #include "wchar_t_short.h"
7 #include <nsCOMPtr.h>
8 #include <nsContentCID.h>
9 #include <nsIStyleSheetService.h>
10 #include <nsServiceManagerUtils.h>
11 #include <nsIURI.h>
12 #include <nsNetUtil.h>
13 #include "wchar_t_default.h"
14
15 #include "xpcom_support.hpp"
16
17 using xpcom_support::check;
18
19 // We just have to load and register a style-sheet as a user
20 // style-sheet.  There is no need to do anything for each page.
21
22 void init_agent_style_sheet(const char * uri)
23 {
24     nsCOMPtr<nsIURI> style_sheet_uri;
25     check(NS_NewURI(getter_AddRefs(style_sheet_uri), nsCString(uri)));
26
27     nsCOMPtr<nsIStyleSheetService> style_sheet_service;
28     static const nsCID style_sheet_service_cid = {
29         // NS_STYLESHEETSERVICE_CID copied from
30         // layout/base/nsStyleSheetService.cpp
31         0xfcca6f83, 0x9f7d, 0x44e4,
32         {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}
33     };
34     check(CallGetService<nsIStyleSheetService>(
35               style_sheet_service_cid, getter_AddRefs(style_sheet_service)));
36     check(style_sheet_service->LoadAndRegisterSheet(
37               style_sheet_uri, nsIStyleSheetService::USER_SHEET));
38 }