2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2001-03-29 00:46:49 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2011-05-23 14:54:03 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2001-04-03 20:11:54 +00:00
|
|
|
#include "nsPrefBranch.h"
|
2004-05-05 14:42:55 +00:00
|
|
|
#include "prefapi.h"
|
|
|
|
|
2011-05-23 14:54:02 +00:00
|
|
|
using namespace mozilla;
|
2001-03-29 00:46:49 +00:00
|
|
|
|
2011-06-12 02:30:15 +00:00
|
|
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
|
|
|
|
Preferences::GetInstanceForService)
|
2001-04-03 20:11:54 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
|
2002-04-09 14:18:39 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
|
2001-03-29 00:46:49 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
|
|
|
|
static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
|
|
|
|
static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
|
|
|
|
|
|
|
|
static mozilla::Module::CIDEntry kPrefCIDs[] = {
|
2013-10-23 20:36:26 +00:00
|
|
|
{ &kPrefServiceCID, true, nullptr, PreferencesConstructor },
|
|
|
|
{ &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor },
|
|
|
|
{ &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
|
|
|
|
{ nullptr }
|
2010-06-10 18:11:40 +00:00
|
|
|
};
|
2002-04-09 14:18:39 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static mozilla::Module::ContractIDEntry kPrefContracts[] = {
|
|
|
|
{ NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID },
|
|
|
|
{ NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID },
|
|
|
|
{ NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
|
|
|
|
// compatibility for extension that uses old service
|
|
|
|
{ "@mozilla.org/preferences;1", &kPrefServiceCID },
|
2013-10-23 20:36:26 +00:00
|
|
|
{ nullptr }
|
2001-03-29 00:46:49 +00:00
|
|
|
};
|
|
|
|
|
2004-05-05 14:42:55 +00:00
|
|
|
static void
|
2010-06-10 18:11:40 +00:00
|
|
|
UnloadPrefsModule()
|
2004-05-05 14:42:55 +00:00
|
|
|
{
|
2011-05-23 14:54:03 +00:00
|
|
|
Preferences::Shutdown();
|
2004-05-05 14:42:55 +00:00
|
|
|
}
|
2001-04-03 20:11:54 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static const mozilla::Module kPrefModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kPrefCIDs,
|
|
|
|
kPrefContracts,
|
2013-10-23 20:36:26 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-06-10 18:11:40 +00:00
|
|
|
UnloadPrefsModule
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(nsPrefModule) = &kPrefModule;
|