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