/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2009 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Zotero. If not, see .
Based on nsChromeExtensionHandler example code by Ed Anuff at
http://kb.mozillazine.org/Dev_:_Extending_the_Chrome_Protocol
***** END LICENSE BLOCK *****
*/
const ZOTERO_CONTRACTID = '@zotero.org/Zotero;1';
const ZOTERO_CLASSNAME = 'Zotero';
const ZOTERO_CID = Components.ID('{e4c61080-ec2d-11da-8ad9-0800200c9a66}');
const ZOTERO_IID = Components.interfaces.chnmIZoteroService; //unused
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULAppInfo);
if(appInfo.platformVersion[0] >= 2) {
Components.utils.import("resource://gre/modules/AddonManager.jsm");
}
// Assign the global scope to a variable to passed via wrappedJSObject
var ZoteroWrapped = this;
/********************************************************************
* Include the core objects to be stored within XPCOM
*********************************************************************/
var xpcomFiles = [
'zotero',
'annotate',
'attachments',
'cite',
'collectionTreeView',
'commons',
'connector',
'dataServer',
'data_access',
'data/dataObjects',
'data/cachedTypes',
'data/item',
'data/items',
'data/collection',
'data/collections',
'data/creator',
'data/creators',
'data/group',
'data/groups',
'data/itemFields',
'data/notes',
'data/libraries',
'data/relation',
'data/relations',
'data/tag',
'data/tags',
'date',
'db',
'debug',
'duplicate',
'enstyle',
'error',
'file',
'fulltext',
'http',
'id',
'integration',
'integration_compat',
'itemTreeView',
'locateManager',
'mime',
'mimeTypeHandler',
'notifier',
'openurl',
'progressWindow',
'proxy',
'quickCopy',
'report',
'schema',
'search',
'style',
'sync',
'storage',
'storage/session',
'storage/zfs',
'storage/webdav',
'timeline',
'translation/translator',
'translation/translate',
'translation/browser_firefox',
'translation/item_local',
'uri',
'utilities',
'zeroconf'
];
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://zotero/content/xpcom/" + xpcomFiles[0] + ".js");
// Load CiteProc into Zotero.CiteProc namespace
Zotero.CiteProc = {"Zotero":Zotero};
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://zotero/content/xpcom/citeproc.js", Zotero.CiteProc);
for (var i=1; i