2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:21:17 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-09-28 23:03:20 +04:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-09-28 23:03:20 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-09-28 23:03:20 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2004-04-18 18:21:17 +04:00
|
|
|
* Suresh Duddu <dp@netscape.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:21:17 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:21:17 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:21:17 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2010-06-10 22:11:11 +04:00
|
|
|
|
|
|
|
#include "mozilla/ModuleUtils.h"
|
2006-03-15 07:59:42 +03:00
|
|
|
#include "nsIClassInfoImpl.h"
|
1999-09-28 23:03:20 +04:00
|
|
|
|
1999-11-10 02:28:10 +03:00
|
|
|
#include "nsSample.h"
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
1999-11-16 10:14:49 +03:00
|
|
|
// With the below sample, you can define an implementation glue
|
|
|
|
// that talks with xpcom for creation of component nsSampleImpl
|
|
|
|
// that implement the interface nsISample. This can be extended for
|
|
|
|
// any number of components.
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Define the contructor function for the object nsSampleImpl
|
1999-11-10 02:28:10 +03:00
|
|
|
//
|
1999-11-16 10:14:49 +03:00
|
|
|
// What this does is defines a function nsSampleImplConstructor which we
|
|
|
|
// will specific in the nsModuleComponentInfo table. This function will
|
|
|
|
// be used by the generic factory to create an instance of nsSampleImpl.
|
1999-11-10 02:28:10 +03:00
|
|
|
//
|
1999-11-16 10:14:49 +03:00
|
|
|
// NOTE: This creates an instance of nsSampleImpl by using the default
|
|
|
|
// constructor nsSampleImpl::nsSampleImpl()
|
1999-11-10 02:28:10 +03:00
|
|
|
//
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleImpl)
|
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
// The following line defines a kNS_SAMPLE_CID CID variable.
|
|
|
|
NS_DEFINE_NAMED_CID(NS_SAMPLE_CID);
|
2000-02-01 01:14:43 +03:00
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
// Build a table of ClassIDs (CIDs) which are implemented by this module. CIDs
|
|
|
|
// should be completely unique UUIDs.
|
|
|
|
// each entry has the form { CID, service, factoryproc, constructorproc }
|
|
|
|
// where factoryproc is usually NULL.
|
|
|
|
static const mozilla::Module::CIDEntry kSampleCIDs[] = {
|
|
|
|
{ &kNS_SAMPLE_CID, false, NULL, nsSampleImplConstructor },
|
|
|
|
{ NULL }
|
|
|
|
};
|
2000-02-01 01:14:43 +03:00
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
// Build a table which maps contract IDs to CIDs.
|
|
|
|
// A contract is a string which identifies a particular set of functionality. In some
|
|
|
|
// cases an extension component may override the contract ID of a builtin gecko component
|
|
|
|
// to modify or extend functionality.
|
|
|
|
static const mozilla::Module::ContractIDEntry kSampleContracts[] = {
|
|
|
|
{ NS_SAMPLE_CONTRACTID, &kNS_SAMPLE_CID },
|
|
|
|
{ NULL }
|
|
|
|
};
|
2000-02-01 01:14:43 +03:00
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
// Category entries are category/key/value triples which can be used
|
|
|
|
// to register contract ID as content handlers or to observe certain
|
|
|
|
// notifications. Most modules do not need to register any category
|
|
|
|
// entries: this is just a sample of how you'd do it.
|
|
|
|
// @see nsICategoryManager for information on retrieving category data.
|
|
|
|
static const mozilla::Module::CategoryEntry kSampleCategories[] = {
|
|
|
|
{ "my-category", "my-key", NS_SAMPLE_CONTRACTID },
|
|
|
|
{ NULL }
|
|
|
|
};
|
2001-03-12 23:43:02 +03:00
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
static const mozilla::Module kSampleModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kSampleCIDs,
|
|
|
|
kSampleContracts,
|
|
|
|
kSampleCategories
|
1999-09-28 23:03:20 +04:00
|
|
|
};
|
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
// The following line implements the one-and-only "NSModule" symbol exported from this
|
|
|
|
// shared library.
|
|
|
|
NSMODULE_DEFN(nsSampleModule) = &kSampleModule;
|
2010-06-25 00:36:27 +04:00
|
|
|
|
|
|
|
// The following line implements the one-and-only "NSGetModule" symbol
|
|
|
|
// for compatibility with mozilla 1.9.2. You should only use this
|
|
|
|
// if you need a binary which is backwards-compatible and if you use
|
|
|
|
// interfaces carefully across multiple versions.
|
|
|
|
NS_IMPL_MOZILLA192_NSGETMODULE(&kSampleModule)
|