2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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
|
|
|
|
2010-06-10 11:11:40 -07:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2011-05-23 07:54:03 -07:00
|
|
|
#include "mozilla/Preferences.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsPrefBranch.h"
|
|
|
|
#include "prefapi.h"
|
|
|
|
|
2011-05-23 07:54:02 -07:00
|
|
|
using namespace mozilla;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-11 19:30:15 -07:00
|
|
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
|
|
|
|
Preferences::GetInstanceForService)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
|
|
|
|
|
2010-06-10 11:11:40 -07: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 13:36:26 -07:00
|
|
|
{ &kPrefServiceCID, true, nullptr, PreferencesConstructor },
|
|
|
|
{ &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor },
|
|
|
|
{ &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
|
|
|
|
{ nullptr }
|
2010-06-10 11:11:40 -07:00
|
|
|
};
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-10 11:11:40 -07: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 13:36:26 -07:00
|
|
|
{ nullptr }
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2010-06-10 11:11:40 -07:00
|
|
|
UnloadPrefsModule()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-05-23 07:54:03 -07:00
|
|
|
Preferences::Shutdown();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-06-10 11:11:40 -07:00
|
|
|
static const mozilla::Module kPrefModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kPrefCIDs,
|
|
|
|
kPrefContracts,
|
2013-10-23 13:36:26 -07:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-06-10 11:11:40 -07:00
|
|
|
UnloadPrefsModule
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(nsPrefModule) = &kPrefModule;
|